Booting a physical drive in VirtualBox


You can use a real, physical drive as a bootable hard disk in Sun Oracle VirtualBox using an undocumented feature, and it even works on Mac hosts!

First make sure the drive is unmounted (aka ejected), it won't cause errors if it's mounted when you attempt this, it simply won't work.

VBoxManage internalcommands createrawvmdk \
-filename [NEW DRIVE NAME].vmdk \
-rawdisk /dev/disk3

Replace the /dev/disk3 with the block identifier that represents the physical drive you want to access, in my case USB and FireWire drives. You can right click any drive in Disk to find out what that is on Mac OS X or your fstab file.

This command essentially creates a pointer to the raw physical drive which you can then add to any virtual machine, just like any other virtual drive. As with creating it though, if it's mounted on the host it won't work. Also this command is undocumented and subject to change, so if the above syntax doesn't work they may have changed it since I wrote this up.

Because it enables raw file access, I'm assuming lower level tools like SpinRite can be used in a virtual machine this way, but I have to confirm this.

For more information, I found this VirtualBox forum topic insanely useful with plenty of relevant links.

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.