Converting VMWare .vmdk To VirtualBox .vdi Using Qemu+ and VBoxManage
If you want to switch to VirtualBox and have a Vmware Virtual Machine you want to use? You can convert a Vmware .vmdk file into a VirtualBox .vdi file that you can use on VirtualBox.
First, download qemu, open a Console and execute:
sudo apt-get install qemu
Next, open a console and go to your .vmdk virtual disc image folder and type this:
qemu-img convert "harddrive-name".vmdk /filelocation/"harddrive-name".bin
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. This takes a few minutes, After the conversion is completed. A raw hard disk image has been created.
To convert a raw disk image to a VirtualBox Disk Image (.vdi) file use this command.
The syntax is as follows:
VBoxManage convertfromraw /filelocation/"harddrive-name".bin <outputfile>
Example:
sudo VBoxManage convertfromraw /home/tony/.VirtualBox/HardDisks/HardDisk1.bin /home/tony/.VirtualBox
[--format VDI|VMDK|VHD]
[--variant Standard,Fixed,Split2G,Stream,ESX]
VBoxManage convertfromraw stdin <outputfile> <bytes>
[--format VDI|VMDK|VHD]
[--variant Standard,Fixed,Split2G,Stream,ESX]
What the parameters mean:
format - Selects the disk image format to create. Default is .vdi.
variant - Allows to choose a file format variant for the output file. It is a comma-separated list of variant flags. Not all combinations are supported, and specifying inconsistent flags will result in an error message.
The second form forces VBoxManage to read the content for the disk image from standard input(useful for using that command in a pipe).
Note: For compatibility with earlier versions of VirtualBox, the “convertdd” command is also supported and mapped internally to the “convertfromraw” command.
Here is a quick example of an actual conversion
tony@ubuntu:~$ sudo apt-get install qemu [sudo] password for tony: Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-2.6.32-24 linux-headers-2.6.32-24-generic Use 'apt-get autoremove' to remove them. The following extra packages will be installed: bridge-utils libaio1 qemu-common qemu-kvm seabios vgabios Suggested packages: mol-drivers-macosx openbios-sparc kvm-pxe ubuntu-vm-builder uml-utilities The following NEW packages will be installed: bridge-utils libaio1 qemu qemu-common qemu-kvm seabios vgabios 0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded. Need to get 2,769kB of archives. After this operation, 8,192kB of additional disk space will be used. Do you want to continue [Y/n]? Y Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid/main bridge-utils 1.4-5ubuntu2 [32.6kB] Get:2 http://us.archive.ubuntu.com/ubuntu/ lucid/main libaio1 0.3.107-3ubuntu2 [9,512B] Get:3 http://us.archive.ubuntu.com/ubuntu/ lucid/main seabios 0.5.1-0ubuntu2 [48.2kB] Get:4 http://us.archive.ubuntu.com/ubuntu/ lucid/main vgabios 0.6c-2ubuntu1 [78.5kB] Get:5 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main qemu-common 0.12.3+noroms-0ubuntu9.2 [30.1kB] Get:6 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main qemu-kvm 0.12.3+noroms-0ubuntu9.2 [2,556kB] Get:7 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/universe qemu 0.12.3+noroms-0ubuntu9.2 [3.9kB] Fetched 2,769kB in 17s(156kB/s) Selecting previously deselected package bridge-utils. (Reading database ... 148121 files and directories currently installed.) Unpacking bridge-utils (from .../bridge-utils_1.4-5ubuntu2_i386.deb) ... Selecting previously deselected package libaio1. Unpacking libaio1 (from .../libaio1_0.3.107-3ubuntu2_i386.deb) ... Selecting previously deselected package seabios. Unpacking seabios (from .../seabios_0.5.1-0ubuntu2_all.deb) ... Selecting previously deselected package vgabios. Unpacking vgabios (from .../vgabios_0.6c-2ubuntu1_all.deb) ... Selecting previously deselected package qemu-common. Unpacking qemu-common (from .../qemu-common_0.12.3+noroms-0ubuntu9.2_all.deb) ... Selecting previously deselected package qemu-kvm. Unpacking qemu-kvm (from .../qemu-kvm_0.12.3+noroms-0ubuntu9.2_i386.deb) ... Selecting previously deselected package qemu. Unpacking qemu (from .../qemu_0.12.3+noroms-0ubuntu9.2_i386.deb) ... Processing triggers for ureadahead ... Processing triggers for man-db ... Setting up bridge-utils (1.4-5ubuntu2) ... Setting up libaio1 (0.3.107-3ubuntu2) ... Setting up seabios (0.5.1-0ubuntu2) ... Setting up vgabios (0.6c-2ubuntu1) ... Setting up qemu-common (0.12.3+noroms-0ubuntu9.2) ... Setting up qemu-kvm (0.12.3+noroms-0ubuntu9.2) ... qemu-kvm start/running Setting up qemu (0.12.3+noroms-0ubuntu9.2) ... Processing triggers for libc-bin ... ldconfig deferred processing now taking place tony@ubuntu:~$ su Password: root@ubuntu:/home/tony# cd /tmp/Ubuntu_VMware root@ubuntu:/tmp/Ubuntu_VMware# qemu-img convert Ubuntu_VMware.vmdk /tmp/Ubuntu_VMware.bin root@ubuntu:/tmp/Ubuntu_VMware# VBoxManage convertfromraw /tmp/Ubuntu_VMware.bin /tmp/Ubuntu_VBox/Ubuntu_VBox.vdi The program 'VBoxManage' is currently not installed. You can install it by typing: apt-get install virtualbox-ose root@ubuntu:/tmp/Ubuntu_VMware# apt-get install virtualbox-ose Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: dkms libaudio2 libmng1 libqt4-network libqt4-opengl libqtcore4 libqtgui4 virtualbox-ose-dkms virtualbox-ose-qt Suggested packages: nas qt4-qtconfig virtualbox-guest-additions The following NEW packages will be installed: dkms libaudio2 libmng1 libqt4-network libqt4-opengl libqtcore4 libqtgui4 virtualbox-ose virtualbox-ose-dkms virtualbox-ose-qt 0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded. Need to get 20.2MB of archives. After this operation, 70.4MB of additional disk space will be used. Do you want to continue [Y/n]? Y Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid/main dkms 2.1.1.2-2fakesync1 [70.1kB] Get:2 http://us.archive.ubuntu.com/ubuntu/ lucid/main libaudio2 1.9.2-3 [81.0kB] Get:3 http://us.archive.ubuntu.com/ubuntu/ lucid/main libmng1 1.0.9-1ubuntu1 [209kB] Get:4 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main libqtcore4 4:4.6.2-0ubuntu5.1 [1,722kB] Get:5 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main libqt4-network 4:4.6.2-0ubuntu5.1 [444kB] Get:6 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main libqtgui4 4:4.6.2-0ubuntu5.1 [4,010kB] Get:7 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main libqt4-opengl 4:4.6.2-0ubuntu5.1 [265kB] Get:8 http://us.archive.ubuntu.com/ubuntu/ lucid/universe virtualbox-ose 3.1.6-dfsg-2ubuntu2 [8,265kB] Get:9 http://us.archive.ubuntu.com/ubuntu/ lucid/universe virtualbox-ose-dkms 3.1.6-dfsg-2ubuntu2 [501kB] Get:10 http://us.archive.ubuntu.com/ubuntu/ lucid/universe virtualbox-ose-qt 3.1.6-dfsg-2ubuntu2 [4,678kB] Fetched 20.2MB in 2min 3s (164kB/s) Selecting previously deselected package dkms. (Reading database ... 148269 files and directories currently installed.) Unpacking dkms (from .../dkms_2.1.1.2-2fakesync1_all.deb) ... Selecting previously deselected package libaudio2. Unpacking libaudio2 (from .../libaudio2_1.9.2-3_i386.deb) ... Selecting previously deselected package libmng1. Unpacking libmng1 (from .../libmng1_1.0.9-1ubuntu1_i386.deb) ... Selecting previously deselected package libqtcore4. Unpacking libqtcore4 (from .../libqtcore4_4%3a4.6.2-0ubuntu5.1_i386.deb) ... Selecting previously deselected package libqt4-network. Unpacking libqt4-network (from .../libqt4-network_4%3a4.6.2-0ubuntu5.1_i386.deb) ... Selecting previously deselected package libqtgui4. Unpacking libqtgui4 (from .../libqtgui4_4%3a4.6.2-0ubuntu5.1_i386.deb) ... Selecting previously deselected package libqt4-opengl. Unpacking libqt4-opengl (from .../libqt4-opengl_4%3a4.6.2-0ubuntu5.1_i386.deb) ... Selecting previously deselected package virtualbox-ose. Unpacking virtualbox-ose (from .../virtualbox-ose_3.1.6-dfsg-2ubuntu2_i386.deb) ... Selecting previously deselected package virtualbox-ose-dkms. Unpacking virtualbox-ose-dkms (from .../virtualbox-ose-dkms_3.1.6-dfsg-2ubuntu2_all.deb) ... Selecting previously deselected package virtualbox-ose-qt. Unpacking virtualbox-ose-qt (from .../virtualbox-ose-qt_3.1.6-dfsg-2ubuntu2_i386.deb) ... Processing triggers for man-db ... Processing triggers for ureadahead ... Processing triggers for desktop-file-utils ... Processing triggers for python-gmenu ... Rebuilding /usr/share/applications/desktop.en_US.utf8.cache... Processing triggers for python-support ... Setting up dkms (2.1.1.2-2fakesync1) ... Setting up libaudio2 (1.9.2-3) ... Setting up libmng1 (1.0.9-1ubuntu1) ... Setting up libqtcore4 (4:4.6.2-0ubuntu5.1) ... Setting up libqt4-network (4:4.6.2-0ubuntu5.1) ... Setting up libqtgui4 (4:4.6.2-0ubuntu5.1) ... Setting up libqt4-opengl (4:4.6.2-0ubuntu5.1) ... Setting up virtualbox-ose (3.1.6-dfsg-2ubuntu2) ... * Stopping VirtualBox kernel modules [ OK ] * StartingVirtualBoxkernelModules * No suitable module for running kernel found [fail] invoke-rc.d: initscript virtualbox-ose, action "restart" failed. Setting up virtualbox-ose-dkms (3.1.6-dfsg-2ubuntu2) ... Loading new virtualbox-ose-3.1.6 DKMS files... First Installation: checking all kernels... Building only for 2.6.32-25-generic Building for architecture i686 Building initial module for 2.6.32-25-generic Done. vboxdrv.ko: Running module version sanity check. - Original module - No original module exists within this kernel - Installation - Installing to /lib/modules/2.6.32-25-generic/updates/dkms/ vboxnetadp.ko: Running module version sanity check. - Original module - No original module exists within this kernel - Installation - Installing to /lib/modules/2.6.32-25-generic/updates/dkms/ vboxnetflt.ko: Running module version sanity check. - Original module - No original module exists within this kernel - Installation - Installing to /lib/modules/2.6.32-25-generic/updates/dkms/depmod.............. DKMS: install Completed. * Stopping VirtualBox kernel modules [ OK ] * Starting VirtualBox kernel modules [ OK ] Processing triggers for python-central ... Setting up virtualbox-ose-qt (3.1.6-dfsg-2ubuntu2) ... Processing triggers for libc-bin ... ldconfig deferred processing now taking place root@ubuntu:/tmp/Ubuntu_VMware# VBoxManage convertfromraw /tmp/Ubuntu_VMware.bin /tmp/Ubuntu_VBox/Ubuntu_VBox.vdi Sun VirtualBox Command Line Management Interface Version 3.1.6_OSE(C) 2005-2010 Sun Microsystems, Inc. All rights reserved. Converting from raw image file="/tmp/Ubuntu_VMware.bin" to file="/tmp/Ubuntu_VBox/Ubuntu_VBox.vdi"... Creating dynamic image with size 17179869184 bytes (16384MB)... root@ubuntu:/tmp/Ubuntu_VMware#
Run VirtualBox, use the (File Menu) Virtual Media Manager and 'Add' the newly cloned drive. This makes Virtual Box 'aware' of the drive. Then go though the normal creation steps and choose this as the drive to use for the virtual machine.
You should be able to boot up the newly created virtual machine.
Enjoy your migration to Virtual Box!
Refrences:
http://www.cyberciti.biz/tips/converting-from-vmware-images-to-virtualbox-images.html#comments