Converting VMWare .vmdk To VirtualBox .vdi Using Qemu+ and VBoxManage: Difference between revisions

From ITCwiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 47: Line 47:


   '''tony@ubuntu:~$ sudo apt-get install qemu  
   '''tony@ubuntu:~$ sudo apt-get install qemu  
[sudo] password for tony:  
  '''[sudo] password for tony:
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Building dependency tree       
Line 110: Line 111:
root@ubuntu:/home/tony# cd /tmp/Ubuntu_VMware
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# qemu-img convert Ubuntu_VMware.vmdk /tmp/Ubuntu_VMware.bin'''


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.
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.

Revision as of 21:36, 22 November 2010

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 [13.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 bash: cd: /tmp/Ubuntu: No such file or directory root@ubuntu:/home/tony# cd /tmp/Ubuntu VMware bash: cd: /tmp/Ubuntu: No such file or directory root@ubuntu:/home/tony# cd /tmp/Ubuntu_VMware root@ubuntu:/tmp/Ubuntu_VMware# qemu-img convert Ubuntu_VMware.vmdk /tmp/Ubuntu_VMware.bin


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://thedarkmaster.wordpress.com/2007/03/12/vmware-virtual-machine-to-virtual-box-conversion-how-to/

https://wiki.ubuntu.com/UbuntuMagazine/HowTo/Switching_From_VMWare_To_VirtualBox:_.vmdk_To_.vdi_Using_Qemu_+_VdiTool

http://www.cyberciti.biz/tips/converting-from-vmware-images-to-virtualbox-images.html#comments

http://download.virtualbox.org/virtualbox/UserManual.pdf