Mount a physical drive inside a Oracle VirtualBox Machine

Submit to reddit

Sometimes I have to check drives under their native operating system. Recently I wanted to access a ntfs partition directly under Windows running inside a virtual machine. Here’s how to (easily) do it:

VBoxManage internalcommands createrawvmdk -filename ./ntfs_test.vmdk -rawdisk /dev/sdb -register

VirtualBox Command Line Management Interface Version 1.5.4

(C) 2005-2007 innotek GmbH
All rights reserved.

RAW host disk access VMDK file ./ntfs_test.vmdk created successfully.

What this means? Well:

We create a virtual machine disk (vmdk) pointing to you physical drive. /dev/sdb in our case, be sure to point to yours. -register if set will tell VirtualBox to already register the drive inside your Virtual Media Manager.

DANGER: the disk will be fully available to the guest operating system. This means full access – so any command you use is definitive. Should you delete, partition or format the drive this will happen exactly as if you have booted the guest operating sytem directly.