Attaching a Block Device To VirtualBox VM (Misc)
I sometimes want to be able to attach a USB disk to my laptop and then pass the entire block device (e.g. /dev/sdb
) through to a Virtualbox VM - for example, to do an OS install for a headless system that doesn't have a functioning graphics card.
The VirtualBox UI doesn't provide an option to do so, however the VBoxManage
command supports creating a virtual hard disk file which is mapped to a specific device path
Details
- Language: Misc
Snippet
cd ~/VirtualBox
VBoxManage internalcommands createrawvmdk -filename sda.vmdk -rawdisk /dev/sda