Both Oracle VirtualBox and VMware Workstation / Fusion use the popular VMDK virtual disk format, optionally as part of an OVA package. Here’s a quick HOWTO on converting VMDK disks to the VHD or VHDX formats for Hyper-V or Azure
To begin with, if you have a file with the OVA extension (e.g. exported from VirtualBox), this is just a TAR archive and all you need to do is to extract the content to have access to the VMDK disks. On Windows you can easily do this with the popular open source 7-zip archiver:
1 |
7z.exe x VM.ova |
Next, we need qemu-img. if you’re using Windows, download and extract our qemu-img for Windows binaries. On Linux you can easily find packages provided by your distribution of choice (e.g. on Ubuntu “apt-get install qemu-utils“).
Now you can convert your VMDK virtual disk(s):
For Hyper-V 2012 and above use the VDHX format:
1 |
qemu-img convert source.img -O vhdx -o subformat=dynamic dest.vhdx |
For Azure and Hyper-V 2008 / 2008 R2 you need the older VHD (vpc) format:
1 |
qemu-img convert source.img -O vpc -o subformat=fixed dest.vhd |
Please note that for Azure you need static VHD files aligned to 1MB. Our version of qemu-img will take care of the alignment for you, alternatively (e.g. on Linux) you will need qemu-img 2.6 or above, adding “-o force_size” to the command line.
You’re now ready to boot your VM in Hyper-V or upload it to Azure. If you’d running Linux, make sure to add the latest Linux Integration Services (LIS).