Based on reading other blogs and websites, exporting a virtual machine from VMware Fusion to Virtual Box can be accomplished into two ways.
- Use the VMware OVF Tool to create a .ovf file to import into Virtual Box
- Export a single .vmdk file from VMware Fusion that is then attached to a new machine instance in Virtual Box
We will be taking the second approach. I did try to use the .ovf file that the VMware OVF Tool creates but I ran into several issues. Creating a single merged .vmdk file and importing this into Virtual Box is much easier.
Step One: Locate Virtual Disk.vmdk
Before we get to the next step we need to take the time to locate the base .vmdk file for your VMware Fusion virtual machine. When you create a new virtual machine you are given the choice where to store the virtual machine. I store all of my virtual machines in my ~/Documents/Virtual Machines folder — you may have chosen to store them somewhere else.
When you open the folder in Finder you should see all of your virtual machines.
Right-click on the appropriate machine and choose Show Package Contents. Inside this folder you should see the Virtual Disk.vmdk file. This is the file we need for the next step.
Step Two: Remove Guest Additions
Before we get started with creating the vmdk file. Let’s jump back and talk about virtual machine guest additions. If your virtual machine that you are exporting includes guest additions you will most likely want to remove these before importing the virtual hard disk into a new system. Guest additions are installed by hypervisors to include driver support or other vendor integration between the host and the virtual machine.
If you are using VMware Fusion, you can follow the steps on their knowledge base article for removing VMware Tools. For me, this was as simple as running the following commands in my Ubuntu terminal.
$ su - root
$ /usr/bin/vmware-uninstall-tools.pl
Step Three: Create .vmdk
The Virtual Disk.vmdk file that VMware Fusion uses for your virtual machine is just a base disk that points to the children disks.
We need to use the vdiskmanager
tool provided by VMware to merge all of these files together into a single dynamic disk .vmdk file.
The vdiskmanager tool is included in your VMware Fusion installation.
It is located at: /Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager
We will use the following options. You can look up all of the options on the documentation web page.
-r
— the Virtual Disk.vmdk source disk we found previously-t
—create a growable virtual disk contained in a single virtual disk file
Here is the command in full. You will need to replace the source file path and the destination paths to meet your needs.
$ /Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -r /Users/brian/Documents/Virtual\ Machines.localized/Ubuntu_10.0.4_Tomcat_7.vmwarevm/Virtual\ Disk.vmdk -t 0 ~/Desktop/Ubuntu_10.0.4_Tomcat_7.vmdk
After successfully exporting the virtual disk to a single .vmdk file we are ready to import the file into Virtual Box.
Step Four: Create New Virtual Machine
Download, install and start Virtual Box if it is not already running. We will then create a new virtual machine in Virtual Box and specify our .vmdk file as the base disk that we created in the previous step. I am going to be creating a new Linux Ubuntu 64-bit machine
- Click on the New icon to create a new virtual machine in Virtual Box. Enter the name of the virtual machine, I am using “Ubuntu 10.0.4”. Make sure that the Type and Version is set according to the type of virtual machine that you exported. Click Continue.
- Enter the amount of RAM, I would suggest 2048MB. Click Continue.
- Choose Use an existing virtual hard drive file, and then browse to the vmdk file that we created previously. Click Create.
The virtual machine has been created. You can throw some more video ram at the machine if you want, or go ahead and Start it up.
Step Five: Install Virtual Box Guest Additions
In this step we will install theVirtual Box guest additions. You might notice after you boot up the machine that the mouse reacts very poorly, or that the maximum resolution is terribly low. This is because the guest additions need to be installed. Installing the guest additions is very easy. There are directions available here.
Since I am using Ubuntu with a GUI, I can simply choose Devices > Insert guest additions CD image… and click on Run after the prompt launches for running the installation. I entered my password, let the installation finish, and reboot the machine.
Now, I can set a nice resolution on the machine and work seamlessly between the host and virtual machine environment.