How to use a physical harddrive in VirtualBox

In some cases it might be very convinient to use a physical harddrive (USB stick, SD card, etc.) as a disk for a virtual machine. It is quite easy on Linux.

  1. Find out which device you want to use, suppose it is /dev/sdb
  2. Make your user the owner of the device file, e.g. sudo chown your_username /dev/sdb. Otherwise VirtualBox won’t be able to use the device
  3. Create a vmdk pointer to the device: VBoxManage internalcommands createrawvmdk -filename ~/link-to-sdb.vmdk -rawdisk /dev/sdb
  4. Voilà, use ~/link-to-sdb.vmdk as a harddrive for your virtual machine

Credit: http://www.serverwatch.com/server-tutorials/using-a-physical-hard-drive-with-a-virtualbox-vm.html