Sunday, March 9, 2014

Converting vmdk files to vdi using VBoxManage

Lets say you want to convert a VMware vmdk disk image to a VirtualBox vdi disk image.  It’s super easy. First let me mention that VirtualBox already supports vmdk files and can use them as is.  However lets continue with the original idea of converting.  I assume you already have VirtualBox installed.
If your vmdk image file is already connected to a guest VM.
  • shutdown the VM
  • remove the vmdk file from the guest VM (you can’t convert it while it is attached to a VM)
From the cmdline, use VBoxManage.   It’s a swiss army knife type of program.  You will see it used for a variety of things.

$ VBoxManage clonehd --format VDI myserver.vmdk \
/srv/d1/VirtualBox/HardDisks/myserver.vdi
 
That is all there is to it.
If you merely want to make a copy of a vdi disk image file, you can leave out the “–format VDI” option.  The vdi disk image files contain a UUID.  The clone process will make sure that the new output file has a different and unique UUID from the original.  If you use “cp” to make a copy of the vdi image file, you will find that the output file is unusable because it contains the same UUID as the original file.  A duplicate UUID is not acceptable to VirtualBox.

No comments:

Post a Comment