How to convert an OVA virtual machine to VHD

virtualbox-convert-ova-to-vhd-vmdk-vdiI’ve got an OVA virtual machine image of VirtualBox. As I use Hyper-V I need to convert ova to VHD before I’ll be able to import OVA virtual machine to Hyper-V.

In order to do this you will need VirtualBox’s VBoxManage.exe utility. You can get it without actually installing VirtualBox on your system by using portable version from vbox.me website.

After extraction you will find VBoxManage.exe in Portable-VirtualBox\app64 folder.

Convert OVA to VHD in two steps:

Get the VMDK files from the OVA

An OVA file is simply a TAR archive file containing the OVF directory. After renaming .ova file to have a .tar extension, you can simply open it with 7z and extract the .vmdk files within to get the virtual machines disks. VMDK is an open format used by VMware and VirtualBox, as such we can make use of VirtualBox which is free to convert these files to VHD.

Converting the VMDK file to VHD

The VBoxManage.exe tool which comes with VirtualBox can be used with ‘clonehd’ directive to specify the new format of the disk. Basically you specify the original disk file, in this case the .vmdk, and then give a location and name to output the .vhd – for further information on this see the VirtualBox documentation here.

Now we run D:\Portable-VirtualBox\app64\VBoxManage.exe as below, the location of which may vary depending on where you have VirtualBox installed.

D:\Portable-VirtualBox\app64>VBoxManage.exe clonehd --format vhd D:\disk1.vmdk D:\disk1.vhd

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Clone hard disk created in format 'vhd'.

UUID: 4cfba843-ca57-73s6-8f79-c532e31f5008

In this example we want to convert disk1.vmdk, the format is specified as vhd as this is what the output should be. Other options include VDI and RAW. disk1 was a 25gb .vmdk file which took approximately 15 minutes to complete and when it was done I had a 60gb .vhd file. The progress should update every 10%.

Now you can create a virtual machine in Hyper-V and use newly created image as HDD.

Good luck!

Want me to do this for you? Drop me a line: itgalaxyzzz {at} gmail [dot] com