There are a growing number of people asking the question: how do you move a VMware virtual machine to VirtualBox. So it is about time the Fat Bloke rolled up his sleeves and showed us how. (BTW you can click on screenshots below to magnify)
People typically want to do this because they have spent time installing a guest OS together with a software stack and they don't really want to go thru all this again. But moving a vm from one virtualization platform to another is analogous in the real world to unplugging a hard drive(s) from one computer and plugging it into a different manufacturer's computer. You may find that the guest operating system gets upset when it boots up and sees virtual hardware which is different than it was expecting. Different guest operating systems react differently to this situation (Linux is typically more accommodating than Windows in this respect). In fact some guest operating systems get so upset, they may BSOD (Blue Screen of Death) on you.
Secondly, some of the software that you have installed above the OS, such as VMware Tools, may also be relying on specific virtual hardware.
So the Fat Bloke's First Rule of VM Migration is: Don't, if you can help it. If you can create a new vm from scratch on the new virtualization platform, you probably should. That way the guest OS installs the right drivers for your particular virtual hardware, and you are not left with orphaned software which needs a specific virtualization layer.
That said, there are still going to be people looking to avoid a complete reinstallation and willing to live dangerously, so let's discuss what is possible. Note that because different guests behave so differently we're going to focus on one guest OS in this blog: Oracle Enterprise Linux, and we'll move it from VMware Workstation 7 to VirtualBox 3.1. Here is our start state, the vm running in VMware Workstation 7 on Windows 7:
It's a good idea to take a copy of the vm that we're trying to migrate just in case you make a mess of things. With VMware Workstation you can clone a vm to do this or copy the machine in some other way such as copying files.
To prepare for migration we're going to remove virtualization platform-specific components:
The Fat Bloke's Second Rule of VM Migration is that it is easier to unpick platform-specific software on the native virtualization platform. So let's start up the vm under VMware to prepare for migration
This is easy enough:
vmware-uninstall-tools.pl
and you should see something like this:
When Oracle Linux was first installed the display was set as a VMware display adaptor and input devices as a VMware keyboard and mouse. By the time we're finished this won't be the case, so let's prepare for that by moving aside the the OEL X.org conf file like this:
mv /etc/X11/xorg.conf /etc/X11/xorg.conf.vmware
This file will get recreated later when we run on the VirtualBox platform.
Now let's shutdown the guest.
The VMware soundcard device is different from the one that VirtualBox exposes so let's remove this device from the vm configuration in the VMware Settings dialog:
A Virtual Machine consists of :
An emerging standard for encapsulating this information to allow vm's to be transported more easily is the OVF or Open Virtualization Format. So in theory you should be able to Export this vm from VMware Workstation and Import into VirtualBox. Sadly, the VMware conversion wizard (File...Import or Export...) doesn't support Oracle Enterprise Linux as a guest:
But there is a command line ovftool that can be downloaded from VMware's site.
So in a Windows command.exe window you can run:
cd C:\\Users\\fatbloke\\Documents\\Virtual Machines\\Clone of Oracle Enterprise Linux
"\\Program Files\\VMware\\VMware OVF Tool"\\ovftool.exe "Clone of Oracle Enterprise Linux.vmx" OEL.ovf
And eventually you end up with 3 files:
We can now move these to the destination system for import by VirtualBox.
You can import an ovf file into VirtualBox from the graphical user interface or the command-line.
Importing this takes a while as the compressed disk is converted to a usable format, but your should end up with a new entry in your vm list in VirtualBox like this:
Now the moment of truth, Start it up...and we should see Oracle Enterprise Linux boot up under VirtualBox
Finally don't forget to install the VirtualBox Guest Additions which is the mirror image operation to removing the VMware Tools.
Once you have mounted the Guest Additions iso image you can run install them from the mounted directory using the command:
sh VBoxLinuxAdditions-x86.run
Like this:
And after a restart of the guest you are all set to go.
Migration is complete!
There is an alternative to step 2 and 3 above for people who know what they are doing.
After performing Step 1 you could simply take the VMware disk image (.vmdk) and plug this into a manually configured VirtualBox vm. This effectively relies on the user to create an appropriately similar vm instead of relying on the ovf export and import (Steps 2 and 3 above) process. Note that the default disk controller used by VMware is an LSI SCSI controller, so when manually creating a VirtualBox vm you need to configure it appropriately.
You still need Step 4 for optimal performance and ease of use. And don't forget the tip about Speeding up Linux Guests too.
Good Luck!
- FB