How to: VirtualBox VM with Physical Hard Drive
|Are you looking for a way to attach a physical hard drive to a VirtualBox virtual machine?
There are several things you need to know.
In the Disk Management screen in Windows, set the disk to ‘offline’ and take note of the disk number, for example Disk #2.
In the command prompt, opened as administrator, cd to the VirtualBox program folder and run:
VBoxManage internalcommands createrawvmdk -filename “C:\temp\rawdiskaccessdisk2.vmdk” -rawdisk \\.\PhysicalDrive2
Replace the disk numbers and paths as needed.
Then attach the VMDK file to the VirtualBox VM. For best compatibility, you may want to use an IDE controller.
Important: run VirtualBox itself as admin, by right-clicking and selecting ‘run as administrator’. Otherwise you will receive an ‘access denied’ error.
By the way, the same method also works on VMware Workstation, but you don’t need to run VMware as administrator.
Have fun!