Converting a physical machine to VM

After many years in software development, I’ve switched machines many times. But I always tried to keep the old ones stored, just in case. Today I’ve finally decided to convert this old machines to a VM, and store only a hard disk and not the whole hardware.

First of all, I started the conversion using VMware vCenter Converter: I installed it to the physical machine (booting it was a small adventure by itself…), and made an image of the disk.

Then, I moved the image to my current system, and started VirtualBox. You can use VMware disk images in VirtualBox. The problem you can find is making Windows to boot. The machine I was converting was an old Windows XP, and switching from real hardware to virtual one poses a problem for this OS: the disk drivers used to boot the system up are “hardwired” at installation time, making this switch somewhat tricky.

So, I tried using the following parameters for the VM with no luck:

  • chipset: PIIX3
  • IO APIC disabled
  • PAE/NX enabled
  • IDE controller PIIX4 (original disk was ATAPI)

On first boot and next several attempts I got a STOP 0x0000007B. After some search, I found the solution was a registry tweak (Mergeide.reg) to be done before moving the system (i.e. before creating the disk image), plus unpacking some drivers to system32\drivers.

So, my solution instead of recreating the disk image was to attach the disk image to another working Windows XP VM, unpack the drivers and do the registry tweaks with this particular changes:

  • Load the system registry hive from the (still) non-functioning disk image by following this procedure. Where it reads “Highlight the HKEY_LOCAL_MACHINE-window and select the root of the tree” this means to select the HKEY_LOCAL_MACHINE key. I used the name “_system” (underscore preceding system).
  • You must tweak the mergeide.reg to point to “HKEY_LOCAL_MACHINE\_system” instead of “HKEY_LOCAL_MACHINE\system” and to “ControlSet00x” instead of “CurrentControlSet”. As I was not sure of which ControlSet was the active one (ControlSet001 or ControlSet003) I repeated the steps for both.
    WARNING: if you apply the changes to system instead of _system you can damage your working VM.
    Second WARNING: if you apply the changes to “CurrentControlSet” the system will not boot, with a STOP 0x67: CONFIG_INITIALIZATION_FAILED. To correct this, load the system hive again and remove the whole “CurrentControlSet” key, and then apply the registry patch again for “ControlSet00x”

That’s it! The system should boot now. After that, you will have to install Guest Additions, configure drivers, etc.