VMware to VirtualBox

VirtualBox Logo

Ok, next step in my VirtualBox adventure! I successfully installed VirtualBox on my new laptop, fixed some performance issues. Next one…

Even if VirtualBox is a wonderfull free application, VMware is a standard in the virtualization world. Lot of products are released for demos or presales activities as VMware guests. In my case, I have a few old VMware images that I’d like to use with VirtualBox. How to achieve this? I read several blog posts about this topic. It seemed that the commands uses to convert the images changed with new versions of VirtualBox, that’s why I investigated by myself.

Both applications use their own file format for hard disk images: .vmdk for VMware and .vdi for VirtualBox. The goal will be to convert a .vmdk into a .vdi. At this point, we don’t need to convert the machine itself. Let’s re-create it into VirtualBox with the same specs as in VMware (CPU, memory, networking, …) later. [Note: The procedure described below was performed on Ubuntu 8.10 with VirtualBox 2.1.0]

First, install qemu if not yet available in your system:

# apt-get install qemu

Before the conversion to .vdi, we need a raw copy of the data. To achieve this, transfer your old .vmdk files into a temporary directory and use the qemu-img tool:

# qemu-img convert guest-disk.vmdk -O raw raw-disk.bin
(VMDK) image open: flags=0x2 filename=guest-disk.vmdk
#

[Note: Conversion to raw format can take some time depending on your config and requires a huge disk space – the raw file was ~3.3 times bigger than the original one]

Now, we use the VBoxManage tool provided with VirtualBox to create the .vdi file. As you alreay use VirtualBox (I presume if your read this article), you don’t have to install any extra package:

# VBoxManage convertfromraw -format VDI raw-disk.bin guest-disk.vdi
VirtualBox Command Line Management Interface Version 2.1.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Converting from raw image file="raw-disk.bin" to file="guest-disk.vdi"...
Creating dynamic image with size 8589934592 bytes (8192MB)...
# ls -l guest-disk.vdi raw-disk.bin
-rw------- 1 xavier xavier 2639299072 2009-01-24 10:17 guest-disk.vdi
-rw-r--r-- 1 xavier xavier 8589934592 2009-01-24 01:33 raw-disk.bin

Once done, add the converted disk image into your Virtual Media Manager:

[Click to enlarge]
Click to enlarge

Finally create a new virtual machine and use your new image!

Important remark: The emulated hardware is different on VirtualBox and VMware. Only UNIX disk images can be converted. You can try Windows but there are risks to encounter problems when booting the converted images.

2 comments

  1. Thanks for the tip – that was very helpful to me. I initially thought that VirtualBox’s converter can convert directly from VMDK to VDI, as it knows both formats (theoretically it can do the other way around – VDI to VMDK directly, though there may be a few bugs with that).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.