Convert VirtualBox .vdi disk to VMWare .vmdk
A couple months ago, I received a laptop upgrade from my company. Naturally, it came with Windows…bleh. I decided to install Ubuntu and dual boot it with XP in the event that I need Windows (which is unfortunately much more frequent than I’d like). I didn’t put too much effort into application support before installing the latest version of Ubuntu, which brings me to the point of this post. VMWare Workstation 6 will not work with the kernel I’m using.
I decided to give VirtualBox a shot given the fact that I did not want to buy a new license. After using VirtualBox for a couple of months, I’m quite pleased with its functionality and ease of use. Disk, and machine configuration are very intuitive and basic. My only quarrel is that it does not allow resizing of virtual disks. This is an issue because I do not want to size a disk extremely large to accomodate future additions or so small that it cannot support my future needs. The ability to resize a disk is very handy for someone like me who creates templates and builds test boxes for each new project that I’m on.
I was finally able to obtain a VMWare Workstation 6.5 license and I’ve been looking into converting an existing VirtualBox .vdi disk file to the VMWare supported .vmdk format. Why waste the effort of installation and configuration of a perfectly good virtual machine? After some extensive reading on options, I discovered a very clean method for handling this. Below are the steps that I’ve taken to convert my disks (note these instructions will have to be modified for your paticular flavor of linux). These are very simple, yet sparingly documented steps for converting a virtual disk from the VirtualBox .vdi format to VMWare .vmdk format.
1. Install Qemu:
sudo apt-get install qemu
QEMU is an open source cross-platform emulator for Linux hosts. It comes with a program called qemu-img, which is a disk image management application. This program can be used to convert disk images to different formats and in the case of our exercise we will use it to convert the raw data to a vmdk format file.
2. Convert the .vdi disk to raw format:
VBoxManage internalcommands converttoraw winxp.vdi winxp.raw
3. Convert the raw data file to VMWare supported .vmdk disk image:
qemu-img convert -O vmdk winxp.raw winxp.vmdk
4. Remove the raw data file now that it is not needed:
rm winxp.raw
5. Resize the disk if necessary:
vmware-vdiskmanager -x 15GB winxp.vmdk
Finally I have space on my windows XP image to store performance data! I hope this exercise helped you as much as it did me.