You can move Hyper-V virtual machines in a Windows failover cluster or on a stand-alone Hyper-V host. Moving virtual machines is a fairly easy process, without having to do too much work at the file level, it’s mostly an export and import process.
In this example, I will cover how to move virtual machines in a Hyper-V failover cluster environment, which is very similar to a stand-alone Hyper-V host. This will cover off moving the .VHD and .XML configuration files together.
- Power down the Virtual Machine you plan on moving
- Export the Virtual Machine to the top level folder of where you want the new Virtual Machine to go (for example c:\CSV). Select the virtual machine, choose the option to Export.
- The export process will create a new folder with the name of the Virtual Machine under the top level folder you chose to export to (c:\CSV). The folder structure will look like this c:\CSV\<VM_Machine_Name>. It will then create 3 more folders under this level:
- Virtual Machines
- Virtual Hard Disks (With the actual .VHD file )
- The export process will take a little while, it has to copy the virtual hard drive.
- Upon export completion, confirm all the files exist in the new location under c:\CSV\
- Delete the Virtual Machine’s cluster service from Failover Cluster Manager (ignore if using a stand-alone Hyper-V host)
- Delete the Virtual Machine in Hyper-V manager; this deletes the previous Virtual Machine’s .XML Configuration file, leaving behind an empty folder shell.
- Import the Virtual Machine back in using Hyper-V Manager
- Using Hyper-V Manager, right click one of the Hosts and Import the Virtual Machine.
- Browse to the location of the newly copied Virtual Machine configuration files which contains the .XML file and the .VHD file. (C:\CSV\<VM_Machine_Name>)
- Choose the option to Move or Restore, click on Import
- Ignore this step if you have a stand-alone Hyper-V host. Configure the imported Virtual Machine for High Availability, right click Services & Applications and Configure a Service or Application.
- Choose Virtual Machine
- Select Virtual Machine and Finish
- Power on the imported virtual machine to confirm it works.
- Delete the old VHD file.