Converting Between Virtual Disk Formats

October 29, 2009

In addition to its own native VDI virtual disk file format, Sun’s VirtualBox supports both Virtual PC’s VHD virtual disk file format and WMWare’s VMDK virtual disk file formats, AND has the ability to convert your virtual disks between these formats.

What they don’t tell you however, is that the virtual disk must be fully removed from the VirtualBox Virtual Media Manager before the command will run successfully (if you have been using the virtual disk previously in a virtual machine in VirtualBox).

For example, the command to convert a VMDK to a VHD is:

"c:\program files\sun\VirtualBox\VBoxManage.exe" clonehd "my.vhd" "my.vmdk" –format vmdk

Below is the documentation from section 8.16 VBoxManage clonehd:

VBoxManage clonehd         <uuid>|<filename> <outputfile>
                           [--format VDI|VMDK|VHD|RAW|<other>]
                           [--variant Standard,Fixed,Split2G,Stream,ESX]
                           [--type normal|writethrough|immutable]
                           [--remember]

where the parameters mean:

format

Allow to choose a file format for the output file different from the file format of the input file.

variant

Allow to choose a file format variant for the output file. It is a comma-separated list of variant flags. Not all combinations are supported, and specifying inconsistent flags will result in an error message.

type

Only honored if –remember is also specified. Defines what kind of hard disk type this image should be.

remember

Keep the destination image registered after it was successfully written.