Move Hyper-V VMs Between Hosts Using Live Migration

PowerADM.com / Virtualization / Hyper-V / Move Hyper-V VMs Between Hosts Using Live Migration

The Live Migration feature in Hyper-V allows you to migrate a running virtual machine between hosts with almost no downtime. Initially, Live Migration in Hyper-V was only available as part of a Windows failover cluster with CSV shared storage. Starting with Windows Server 2012, Hyper-V Live Migration doesn’t require a cluster and shared storage. To migrate VMs, Hyper-V hosts need to be connected using a fast shared Ethernet network. This type of migration is called a Shared-nothing live migration.

Hyper-V Live Migration Requirements:

  • At least two Hyper-V hosts are members of the same Active Directory domain;
  • VM hardware version 5.0 or higher;
  • The target host must have sufficient resources (memory, RAM) to start the VM;
  • The same architecture processors must be used on Hyper-V hosts. You can enable CPU Compatibility Mode for the VM: Set-VMProcessor testvm1 -CompatibilityForMigrationEnabled $true);
  • Recommended minimum of 1Gb Ethernet network between the hosts (it is a good idea to have a separate NIC for live migration traffic.). The Client for Microsoft Networks and File and Print Sharing for Microsoft Networks protocols must be enabled on the network adapters;
  • Each Hyper-V host must be able to access its own virtual machine storage (local disks, SAN LUNs, or SMB 3.0 shared folders). Pass-through drives are not supported;
  • Virtual switches on all Hyper-V hosts must have the same. This will help you avoid many problems.

The following resources are moved between Hyper-V hosts during Live Migration

  • Virtual machines;
  • Virtual disk;
  • VM memory contents;
  • CPU state.

Let’s take a look at how to enable and configure Live Migration in Hyper-V on Windows Server 2019/2016:

    1. Open Hyper-V Settings on both hosts, go to the Live Migration, and check the option “Enable incoming and outgoing live migration”. You can change the maximum number of virtual machines that can be moved simultaneously (Simultaneous live migrations). To avoid a heavy load on hosts and network, it is better to leave the default value (two simultaneous migrations);
    2. Specify which Hyper-V hosts can migrate the VM to this server in the Incoming Live Migration section; enable hyper-v live migration
    3. Then go to the Advanced Features section and select the Kerberos authentication protocol. use kerberos auth for hyper-v migration

You can do the same using PowerShell (don’t forget to configure all Hyper-V hosts):

Enable-VMMigration 
Set-VMMigrationNetwork 192.168.1.2 192.168.1.4
Set-VMHost -VirtualMachineMigrationAuthenticationType Kerberos
Note. Compression is used by default to make migrating faster. You can also use SMB Direct with RDMA support for migration. You can disable end-to-end SMB data encryption to speed up Live Migration:

Set-SmbServerConfiguration -EncryptData $false -RejectUnencryptedAccess $false

If you are using Kerberos authentication to migrate VMs between hosts, you must configure Kerberos Constrained Delegation in the properties of the Hyper-V host account in Active Directory.

Start the ADUC console (dsa.msc), open the properties of the Hyper-V host account, and go to the Delegation tab. Select the option Trust this computer for delegation to specified services only -> Use Kerberos Only.

Click Add -> select the second Hyper-V host and the Microsoft Virtual System Migration Service.

Enable Kerberos Constrained Delegation for Hyper-V in Active Directory

In Hyper-V on Windows Server 2016, when you use this option to move VMs, you might encounter an error “No credentials are available in the security package” (Event ID 20306). This is because, in these versions of Windows Server, Hyper-V services run in the context of NETWORK SERVICE. You must use the less secure Unconstrained Delegation (use any authentication protocol) mechanism to fix this bug.

All Live Migration servers must have the same settings.

Now try to migrate the VM from one Hyper-V host to another:

  1. Right-click on the virtual machine and select Move; Move VM between Hyper-V hosts
  2. Select the type of migration – Move the virtual machine; Move the virtual machine
  3. Select the target Hyper-V server to which you want to move your VM.;
  4. Select Move option: Move the virtual machine’s data to a single location; Move the virtual machine’s data to a single location
  5. Wait for the VM migration to another Hyper-V host to complete.

If Live Migration is not enabled on the target host, or if your server is not added to the Incoming Live Migration list, you will receive an error:

Live migrations are not enabled on this computer.
This computer is not configured for live migration of virtual machines. To enable live migration, modify the Hyper-V settings.

You can also start Live Migration using PowerShell:

Move-VM myvm1 nyhv01 -IncludeStorage -DestinationStoragePath D:\vm\myvm1
One thought on “Move Hyper-V VMs Between Hosts Using Live Migration”
  1. When I run the VM migration through powershell, it works. But if I run it through Hyper-V Manager, it gives me error 0x8009030E

Leave a Reply

Your email address will not be published. Required fields are marked *