Skip to content

Live Migration

Hyper-V live migration enables moving virtual machines (VMs) between hosts with minimal downtime, preserving VM state and connectivity. This process requires careful planning to ensure compatibility, resource availability, and network readiness. Below are the steps and prerequisites for setting up and executing live migration.


Prerequisites for Live Migration

  1. Host Requirements:
  2. Both source and destination hosts must run Windows Server 2012 R2 or later.
  3. Hyper-V role must be enabled on both hosts.
  4. Hosts must be part of the same domain or have trust relationships if not in a cluster.
  5. Time synchronization must be configured (e.g., via Windows Time service or NTP).

  6. Storage Requirements:

  7. VMs must reside on shared storage (SAN, NAS, or clustered storage) accessible by both hosts.
  8. Shared storage must support live migration (e.g., SMB 3.0 or iSCSI).

  9. Network Requirements:

  10. A dedicated migration network or shared network with low latency.
  11. Virtual switches must be compatible (e.g., standard switches, not private or external).
  12. Ensure hosts have sufficient bandwidth to handle VM data transfer.

  13. VM Requirements:

  14. VMs must be in a running state.
  15. VMs cannot use features like dynamic memory, live storage migration, or virtualized SCSI.
  16. VMs must not be in a paused or saved state.

Setup Steps for Live Migration

  1. Enable Live Migration on Hosts:
  2. Open Hyper-V Manager, select a host, and go to Virtual Machine Settings.
  3. Ensure Live Migration is enabled under the Hyper-V Settings.
  4. Alternatively, use PowerShell:

    Set-VMHost -EnableLiveMigration $true
    

  5. Configure Shared Storage:

  6. Ensure VM VHDs are stored on a shared storage array.
  7. Verify storage access via PowerShell:

    Test-VMStorageAccess -Path "E:\VMs\MyVM.vhdx"
    

  8. Set Up Migration Network:

  9. Assign a dedicated IP subnet for migration traffic (e.g., 192.168.10.0/24).
  10. Configure network adapters on both hosts to use this subnet.

  11. Verify Host Compatibility:

  12. Ensure both hosts have identical CPU features (e.g., same vendor, architecture, and virtualization extensions).
  13. Use PowerShell to check host compatibility:
    Get-VMHost | Select-Object Name, CPUCount, MemoryAssigned
    

Execution Steps for Live Migration

  1. Initiate Migration via GUI:
  2. In Hyper-V Manager, right-click the VM and select Move > Live Migration.
  3. Choose the destination host and confirm.

  4. Initiate Migration via PowerShell:

  5. Use the Move-VM cmdlet:
    Move-VM -Name "MyVM" -DestinationHost "TargetHost" -LiveMigration
    
  6. Monitor progress with:

    Get-VM -Name "MyVM" | Select-Object MigrationStatus, MigrationProgress
    

  7. Monitor Migration:

  8. Check the Hyper-V Manager console for migration status (e.g., "Migrating" or "Completed").
  9. Review event logs for errors (e.g., Event ID 1246 for migration failures).

  10. Post-Migration Verification:

  11. Confirm the VM is running on the destination host.
  12. Validate network connectivity and VM performance.

Troubleshooting Common Issues

  • Network Latency: Ensure migration network has low latency (target < 50ms).
  • Storage Access: Verify shared storage is accessible via Test-VMStorageAccess.
  • CPU Mismatch: Use Get-VMHost to ensure hosts have compatible CPU features.
  • Resource Constraints: Ensure destination host has sufficient memory and CPU.
  • Firewall Rules: Allow ICMP and SMB traffic between hosts.

Key takeaways

  • Live migration requires shared storage, compatible hosts, and a dedicated network.
  • Use PowerShell for automation and real-time monitoring.
  • Always verify VM compatibility and resource availability before migration.
  • Troubleshoot network latency, storage access, and CPU mismatches promptly.
  • Post-migration validation ensures service continuity and performance.