Running Windows 7 from the Bootcamp partition in VirtualBox

Mac OS X has this nifty feature called Bootcamp that allows you setup a dual-boot system with Windows. Setting up Windows is fairly painless. Using Windows however requires a reboot. VirtualBox is a cool (and free) tool to install multiple operating systems in virtual machines, so you can run Windows or Ubuntu on your Mac without rebooting, right inside Mac OS X. It is even possible to use VirtualBox with the partition created by Bootcamp, so you can run the same copy of Windows (with all your settings and software intact) without rebooting your Mac.

Gianpaolo over at phaq has written a great and easy-to-follow tutorial to get VirtualBox up and running your Bootcamp partition. I’m not going to plagiarise and fully copy Gianpaolo’s work here, just head over to his blog and follow the steps.

I would however like to make one addition. Gianpaolo describes how to create the virtual hard disk files that VirtualBox needs to read the Bootcamp partition:

VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 3

For VirtualBox to actually read those files I had to set the permissions of the two files that were created. If you find that VirtualBox is unable to read win7raw.vmdk the following command might fix it:

sudo chmod 777 *.vmdk

Obviously make sure you are in the directory where you created the vmdk files when you do this.