Passthrough Mounting A Physical Disk Drive in VirtualBox 🌱

Creating the Physical Disk VMDK

  1. Connect the physical disk to the host
  2. Log into the VirtualBox host
  3. Launch PowerShell as administrator
  4. Run the following commands
    # list physical disks
    Get-PhysicalDisk
  5. Take note of the disk number for the target disk to mount in VirtualBox
  6. Continue with the following commands
    # cd to the virtualbox installation directory
    cd "$ENV:ProgramFiles\Oracle\VirtualBox"
    # create a vmdk disk pointing to the target physical disk
    # usage
    # .\VBoxManage.exe internalcommands createrawvmdk -filename "<%fullpathto.vmdk%>" -rawdisk \\.\PhysicalDrive<%disknumber%>
    .\VBoxManage.exe internalcommands createrawvmdk -filename "D:\VMs\SSD.vmdk" -rawdisk \\.\PhysicalDrive2
    # launch virtualbox manager
    .\VirtualBox.exe

Attaching the Physical Disk to a Virtual Machine

NOTE: If you don't run VirtualBox Manager as administrator you will get permissions errors trying to access the physical disk

  1. Right click on the target VM > Settings
  2. Select Storage from the left navigation menu
  3. Click the Add Hard disk icon
  4. Click Add > Browse to and select the .vmdk file created earlier
  5. Scroll to the bottom of the listing and select the .vmdk > Click Choose
  6. Click OK to confirm the VM settings
  7. Right click on the target VM > Start

Documentation: https://www.virtualbox.org/manual/ch09.html#rawdisk