While creating a virtual machine in Virtualbox is an easy task, sharing the virtual machine across different OS is not. If you are dual-booting your computer and have created a virtual machine in one of the OS partition, due to the difference in file structure among the different OS, you will not be able to access and open the VM file in the other partition.
To illustrate: let’s say you have installed Win XP on your Macbook via boot camp. As you have heard so much about Ubuntu and wanted to try it out, you installed Virtualbox and created an Ubuntu virtual machine in your Mac partition. One day, while doing your work in the Win XP partition, you found that you need to access some applications in the Ubuntu virtual machine. There is no way for you to open the Ubuntu virtual machine in Windows since you can’t access your Mac partition. Now, rather than rebooting into the Mac partition, wouldn’t it be great if you can access and open the Ubuntu virtual machine in the Windows partition?
The above situation will happen even if you are running a Linux/Mac or Linux/Windows dual boot. The following tutorial will show you how you can have access to your Virtualbox virtual machine regardless of which OS you are in.
The rule of thumb:
Always create your Virtualbox virtual machine (the file with a vdi extension) in a NTFS partition.
That is to say, if you are dual-booting Windows and Linux/Mac, always save the vdi file in your Windows partition. For those with Mac and Linux, you will have to create a new NTFS partition either on your existing hard disk or on an external hard disk (preferably).
Here’s the complete tutorial to access the virtual machine from different OS
- Click here if you are dual-booting Windows and Mac/Linux.
- Click here if you are dual-booting Mac and Linux.
For computer that dual-boot Windows and Mac/Linux
- Boot into Windows
- Download and install Virtualbox for Windows (if you have not done so).
- Create your virtual machine as you always do. Note the file path where you save the virtual machine vdi file.
Restart your computer and boot into the other OS.
- Download and install MacFuse and NTFS-3G. It will prompt you to restart your computer. After the restart, you will see a new drive mounted on your desktop. That is the Windows partition.
- Download and install Virtualbox for Mac (for Intel Macs only).
Now, we are going to create an entry on your Virtualbox and make it point to the vdi file in the Windows partition.
- Open the Virtualbox application.
- On the top of the window, click “New” to create a new virtual machine.
- Click Next and follow the instruction to create a new VM until you reach the point where it asks you to specify your hard drive
- Click on “Existing”. In the next window, click on the “Add” and point the file path to the vdi file in the Windows partition.
- You should now see an entry in the window. Highlight the entry and click “Select”.
- On the next window, click “Next” follow by “Finish”. It will bring you back to the main window.
- Highlight the new VM entry on the main window and click “Start”. You should see the same virtual machine that you have created in your Windows partition running in your Mac now.
Dual-booting Linux and Windows
Restart your computer and boot into the Linux partition.
- Install “ntfs-3g” (if you are using Ubuntu Hardy, you can skip this step. Ntfs-3g is already pre-installed in your system)
- Download and install Virtualbox for your Linux distro (if you have not done so).
Now, we are going to repeat the same steps as we did in Mac (follow the screenshots instructions above) to create an entry on Virtualbox to point to the virtual machine in the Windows partition.
For computers that dual-boot Mac and Linux
If you are dual-booting Mac and Linux, first boot into the Linux partition.
- Follow this guide to format your external hard disk to NTFS format. (You can also resize and create a new partition on your existing hard disk and format it to NTFS format. I will cover that in the future).
- Download and install Virtualbox. Create a new virtual machine and follow the instructions until it asks you the location of your hard disk.
- Click “New” to create a new virtual hard disk. Click “Next” until it asks you where to store your virtual hard disk
- Click on the icon beside the “Image File name” field and select any folder in the external NTFS hard disk. This will save the vdi file in the external hard disk rather than its default location.
- Proceed on with the standard installation of the guest OS.
Once you are done creating the virtual machine, reboot into Mac and follow the above step to configure the Virtualbox in your Mac to access the VM on the external hard disk.