Now we need to convert your existing VMWare disc image into a format readable by VirtualBox.
Don't worry, you won't lose any data but, just in case, you can always create a backup copy of your VirtualDisk before we start!
First of all, download qemu, you can do it using Synaptic or simply opening a Console and executing:
sudo apt-get install qemu
Now open a terminal and go into the folder where you’ve got your .vmdk virtual disc image and type this:
qemu-img convert harddrive-name.vmdk raw-file.bin
Naturally, you’ll have to change harddrive-name with the name of your .vmdk file and raw-file with the name of the new converted file you want to create. After a few minutes, the conversion will be completed. Now we’ve got a raw hard disk image and we want to transform it into a .vdi file!
We need a new application called „vditool“. You’ll find it here: http://www.virtualbox.org/download/testcase/vditool Download it into the same dir where you’ve got your new raw .bin disc image file. A simple way to download this app is from the command line, like so:
wget http://www.virtualbox.org/download/testcase/vditool
Now that we’ve got vditool, we need to make it executable. Right click on the file, open its properties and set the “Executable” permission option. In Gnome, go into the Permission tag and activate the “Let this program be executed” or something like that option (Remember, my Ubuntu is Italian, dunno what’s your exact translation).
At that point, we’ll need the terminal again, from the same dir where you’ve stored vditool and the .bin raw file. Run this from console into the interested dir:
LD_LIBRARY_PATH=/opt/VirtualBox* ./vditool DD new-file.vdi old-file.bin
Where new-file.vdi is the file that will be outputted by vditool and must be the first to appear in the command. The second filename, old-file.bin, is the name of the raw disc image we converted the .vmdk image to. Naturally, change these invented names for real ones.
Let's optimize the file size of the newly converted .vdi file, let’s call it new-file.vdi and from the terminal in the dir where you’ve got this file, run:
LD_LIBRARY_PATH=/opt/VirtualBox* ./vditool SHRINK new-file.vdi
Now we’re all set up.
LD_LIBRARY_PATH=/usr/lib/virtualbox /usr/lib/virtualbox/vditool DD new-file.vdi old-file.bin LD_LIBRARY_PATH=/usr/lib/virtualbox /usr/lib/virtualbox/vditool SHRINK new-file.vdi
(These commands should actually work on both 32bit and 64bit systems).