Most of the time you use desktop virtualization, you simply add a virtual hard drive and install a guest operating system (like (K)Ubuntu Linux) in it. But some times – as in my case – you already have another operation system on a partition on your native hard drive. For a mac it’s either via Bootcamp or via something like rEfit enabling you to install a BIOS boot manager like Grub. Since it is kind of uncommon using such an existing partition for desktop virtualization, it is not supported (and documented) so good in the different virtualization solutions.
In this article, I will briefly describe, how to do this in Mac OS X via Virtual Box. At first you create a fake virtual drive of your native hard drive selecting the partitions you like to “offer” to your virtual machine (type the following into the “Terminal” application):
sudo VBoxManage internalcommands createrawvmdk \ -filename /${HOME}/VirtualBoxes/rawubuntu.vmdk \ -rawdisk /dev/disk0 -partitions 3,4
Then you have to start virtual box via the terminal as root (because root has read/write access to your hard drive):
sudo /Applications/VirtualBox.app/Contents/MacOS/VirtualBox
It’s a pretty shame that you have to do this, but I didn’t find a way around this. You should really think about doing this, as you give the virtual box root access! I switched to parallels because of that (and it has better performance/memory management; unfortunately it costs 80$, but if you are at a university either as a student or a employee you’ll get it for half the price).
Simply create a new vbox with the rawubuntu.vmdk
as hard drive and (nearly (see below)) everything should just work like a charm.
What didn’t work
Connecting USB Mass storage devices.
What is bad about VirtualBox
- AFAIK it has no hypervisor support and is quite slow/has a high CPU overhead
- It reserves the complete memory you give the guest system right from the beginning (parallels uses only the memory the guest system needs currently)