Convert VirtualBox (vmi) to real disk?
It is often the case that I need to set up training machines, and sometimes I get VirtualBox images that I need to deploy to the machines. I tend to avoid virtualization 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 and good drivers, you can get a decent performance improvement with WPF apps, but unfortunately, some virtualization drivers are too poor.
So how can I take a virtual hard disk created in VirtualBox and easily convert it to a physical disk so it can just run?
Process:
It is possible, but it is not easy to convert it to a real disk. Here’s how:
Step 1: You need to use a tool from Microsoft called SysPrep to unload the drivers. Basically, this means 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 VDI (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 that 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 SysPrep will not remove that, causing the restoring process to 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 follow if you want to use SysPrep with SQL Server: Microsoft Docs.
So make the time to have the first few attempts fail and learn the nuances of the software you work with.