lxndryng - a blog by a millennial with a job in IT

Apr 12, 2017

Using physical devices in VirtualBox

If this post is useful to you, I'd greatly appreciate you giving me a tip over at PayPal or giving DigitalOcean's hosting services a try - you'll get 10USD's worth of credit for nothing

Sometimes it may be useful to, for example, access a physical Linux installation on a device from within another physically-installed operating system on the same device. Fortuntately, this is possible with the VBoxManage command for VirtualBox. An example of such a command is given below:

VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda

On Windows, the argument for the -rawdisk switch should take the form of \\.\PhysicalDrive0, where the disk identifier can be found using diskpart's LIST DISK command. The VBoxManage command needs to be run as Administrator, with any virtual machines to be launched using the VMDK produced also requiring VirtualBox to be run as an Admionistrator in order to be able to access the disk.