Raw Disk Access with Virtualbox

By | 2010/06/26

How can I use Virtualbox to access a raw hard disk?

First, make sure drive is connected and not mounted.
Also, make note of the drive location either by issuing dmesg or using the Ubuntu System > Administration > Disk Utility. In my case, it’s /dev/sde .

Then issue this single command:

 sudo VBoxManage internalcommands createrawvmdk -filename ~/rawdisk.vdi -rawdisk /dev/sde

^Note: In older pre-Virtualbox 4.x, tack on -register at the end.

This will output the following in the terminal:

Oracle VM VirtualBox Command Line Management Interface Version 3.2.6
(C) 2005-2010 Oracle Corporation
All rights reserved.

RAW host disk access VMDK file /home/user/rawdisk.vdi created successfully.

Due to the nature of having raw disk access, you must start virtualbox with sudo (Eek!). (Of course you should not normally do this.)

Next, start virtualbox with sudo:

sudo VirtualBox

Now make a new machine as DOS for example, if you are using any various hard drive utilities. At the Virtual Hard Disk step, choose the rawdisk.vdi you created.


I’m going to scan this drive with spinrite, for an example of what you could do with raw disk access!

spinrite doing its magic