Skip to main content

It is often the case I need to setup training machines and a sometimes I get VirtualBox images which I need to deploy to the machines. I tend to avoid virtualisation on the training machines because of driver related issues, especially with graphic cards and things like WPF (which powers Visual Studio). If you have a good graphics card & good drivers then you can get a decent perf improvement with WPF apps, but unfortunately some virtualisation drivers are too poor.

So how can I take an virtual hard disk created in VirtualBox and easily convert it to physical disk so it can just run?

Process:

It is possible but it is not easy to a real disk but it is not easy.

  • Step 1: You need to use a tool from Microsoft called SysPrep to unload the drivers. Basically this means that it strips all the driver info out, and puts the image in a clean state so that the next time it boots Windows searches for the hardware again. If you do not do that Windows will freak out because the hardware it expects does not exist.
  • Step 2: Then you use a tool designed for disk imaging to create an image. Tools like Norton Ghost (paid) or CloneZilla (free) are designed for this purpose and the image they create is portable unlike the vmi (VirtualBox hard drive) format which can't do this well.
  • Step 3: You then restore that image to the real disk using the same tool and you are done.

Slightly more work than you would expect, but that is a solution which always works.

Caveats:

I have not tried this with Hyper-V or VirtualPC disks (vhd) yet, but I suspect VirtualPC will work fine. Hyper-V has an additional Hypervisor layer and I suspect that SysPrep will not remove that and the restoring process will fail.

Finally you also want to be careful with SysPrep as it can have some undesired effects with certain software, for example SQL Server. There are specific steps to go through if you want to use SysPrep & SQL Server: http://msdn.microsoft.com/en-us/library/ee210754.aspx

So make the time to have the first few attempts fail and learn the nuances of the software you work with.