Share via


Hyper-V: P2V with Disk2VHD

Introduction

While the recommended way is to use SCVMM for converting physical machines to Hyper-V VMs, budget and resources can make you look for other options. One possibility is the free sysinternals tool Disk2VHD.

Usage

The usage of Disk2VHD is fairly simple. Starting it will present you with a GUI letting you select which drives you want to convert. Select the System partition (and other partitions you will need for the VM). Note that for example VirtualPC has a limit of 127GB, and the size of the created VHD is not the partition size but the drive size.

Creating the VM

Once you have created and copied the VHD file, create a VM in Hyper-V manager (or cluster manager if you are using a cluster setup) and reference the existing VHD file. It's a good idea to try to let the VM have similar settings like the original machine (RAM, number of CPUs, etc.). You will lose network connectivity upon conversion, which you have to add back into the machine by installing the guest tools (Hyper-V Integration Components).

Cleaning up

After you have the VM running, it's a good idea to uninstall unused drivers and remove no longer present hardware. Prominent examples would be graphic card and NIC drivers. (For example, Dell Servers usually have Broadcom Network drivers installed. Uninstalling them removes the no longer present NIC device.) Other devices you will have to make visible first before cleanup. See KB315539 for instructions on how to do this.

Observed issues

There are a few things that can go wrong, some of them easier fixed than others (Feel free to add things you observed).

  • You might get Inaccessible Boot Device BSOD (0x7B) after installing the ICs on the next reboot. This happens when the Windows Driver Framework was already installed before the ICs are installed. If the ICs install it, they automatically set the Group Value correct. However, if WDF is already present, it seems to skip it. You can manually set "Group" (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Wdf01000) before rebooting after the IC installation to "WdfLoadGroup" or if you already have the BSOD follow this instruction.
  • Another case of 0x7B we experienced was with a Windows 2003 SP2 x64 conversion that originally booted from a SCSI disk. In that case, the registry entries for IDE (which is used as boot controller in the VM) weren't present. While not supported, injecting the mergeide.reg from KB314082 fixed the issue in that case for us (for the injection we mounted the VHD on a Windows 7 system and opened the system.dat via running regedit, selecting HKLM node, file load hive).
  • Some of our converted VMs had the boot partition seemingly empty. Turned out this was due to a former partition resize with a 3rd party tool. Once chkdsk fixed the issue on the original physical machine, the partition was created properly on the next disk2vhd. So if you have trouble with that, before you try to fix the partition with 3rd party tools, give chkdsk a try.

Useful Resources: