Disclaimer: Like some of my other posts here, I’ve shared this snippet on other websites out there. Still, I reserve the right to re-use my own material 😉
OK then. There have been times in the past when it was necessary for me to convert a VirtualBox disk file to a format that I could use in VMware. Virtualbox, in combination with the qemu
utilities, provides us with a way to get that job done. Conversion takes time, and the larger your disk file, the longer it takes. With this in mind, here below is the chain of commands you’ll need to accomplish the desired outcome:
$ VBoxManage internalcommands converttoraw myvirtualmachine.vdi myvirtualmachine.raw && qemu-img convert -O vmdk myvirtualmachine.raw myvirtualmachine.vmdk && rm -vi myvirtualmachine.raw
The benefit: using this method actually works. There are others out there that claim to give you a working .vmdk by simply using the qemu-img
command alone. Doing that only results in pain for you because the .vmdk file will be created with no errors, but it won’t boot either.
Be aware that this is a very I/O intensive, and depending on some other factors it could cause your system to slow down dramatically during the process. It’s probably best to do the conversion at a time when you’re not in a hurry to get other things done.