VirtualBox: add a physical hard disk to your virtual machine in Debian


When running a virtual machine in VirtualBox we use a virtual hard disk. We are going to learn how to set a virtual hard disk that points to a physical hard disk.

I run VirtualBox in my host Debian system.


The user should pertain to disk group in order to access physical hard disks.
$ adduser my_user disk

Login again if needed so change becomes effective.


Create a vmdk image using the device name (in rawdisk option):
$ VBoxManage internalcommands createrawvmdk -filename "my_image.vmdk" -rawdisk /dev/disk/by-id/ata-ST1000LM024_HN-M101MBB


Launch virtualbox:
$ virtualbox

Create a new virtual machine and when asked for a hard disk use the vmdk image you just created.