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.

Advertisements

11 thoughts on “Converting vmdk files to vdi using VBoxManage

  1. Hi , I have just lately come across your blog and I have to say, that the content, for me, is the best on the internet. Thank you so much for this superb resource.

  2. Thanks Very much – saved me a lot of work just one thing, in the command line $ VBoxManage clonehd –format VDI myserver.vmdk \
    /srv/d1/VirtualBox/HardDisks/myserver.vdi
    leave out the ”\” after vmdk – just make sure there is a least one space.
    Also in in the Command Prompt box go to the home direcetory (\Program Files\Oracle\VirtualBox) of Virtual Box before executing the VBoxManage command.
    The reason I could not open my orignal VDI file was (I think) because I had moved/copied it to another directory – don’t copy or move them!

  3. VBoxManage convertfromraw -format VMDK source.img target.vmdk
    The size of source file was 3 GB and it was ubuntu image but it got converted to 1 GB image.when I boot this image it shows no bootable device.Can someone explain why the file size reduces and wy the image is not able to boot?????

    • Not all targets and sources are compatable. VBoxManage will not warn you if the target you are making is not compatable. You might have ended up with a compressed image, which was not usable in that format. Try using the –variant option. Such as –variant Fixed or –variant ESX when converting to a vmdk image. I believe either of those will result in a non-compressed image.

  4. Pingback: export virtual machine from VirtualBox to VMWare and the other way ’round | not relevant / permanent TODO

  5. Thanks for the help. You mention that VirtualBox supports vmdk natively, which is true, but vboxmanage’s modifthd function is unable to resize vmdk images. Great reason to convert to vdi. Worked nicely, thx again.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s