Moving virtual machines between disks in Hyper-V

The trouble with running Microsoft Hyper-V on a notebook PC is that notebook PCs typically don’t have large hard disks. Add a few snapshots and a virtual machine (VM) can quickly run into tens or even hundreds of gigabytes and that meant that I needed to move my VMs onto an external hard disk.

In theory at last, there should also be a performance increase by moving the VMs off the system disk and onto a separate spindle; however that’s not straightforward on a notebook PC as second disks will (normally) be external (and therefore using a slower USB 2.0 interface, rather than the internal SATA controller) – anyway, in my case, disk space was a more important than any potential performance hit.

Moving VMs around under Hyper-V is not as straightforward as in Virtual Server; however there is an export function in Hyper-V Manager that allowed me to export a VM to my external hard disk, complete with snapshots (Ken Schaefer describes the equivalent manual process for moving a Hyper-V VM on his blog).

The exported VM is still not ready to run though – it needs to be imported again but the import operation is faster as it doesn’t involve copying the .VHD file (and any associated snapshots) to a new location. After checking that the newly imported VM (with disk and snapshot storage on the external drive) would fire up, I deleted the original version. Or, more accurately, I would have done if I hadn’t run out of disk space in the meantime (Windows Server 2008 doesn’t like it when you leave it with only a few MB of free space).

Deleting VMs is normally straightforward, but my machine got stuck half way through the “destroy” process (due to the lack of hard disk space upsetting my system’s stability) and I failed to recover from this, so I manually deleted the files and restarted. At this point, Hyper-V manager thought that the original VM was still present but any attempt to modify VM settings resulted in an error (not surprising as I’d deleted the virtual machine’s configuration file and the virtual hard disks). What I hadn’t removed though was the shortcut (symbolic link) from the to my external hard disk. Deleting this file from %systemdrive%\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines and refreshing Hyper-V Manager left me with a clean management console again.

2 thoughts on “Moving virtual machines between disks in Hyper-V

  1. I know this thread is old, but it’s also one of the first ones which pop up on google search. The best way I’ve found to move the VM from one storage to another is to use VMM – right click the VM in question, select “Migrate Storage” and then select the target Storage. To migrate to another host, use “Migrate” and then select the target host.

Leave a Reply