Skip to content

Using a raw disk as a VirtualBox drive

VirtualBox was capable of using physical disks for virtual machines. For more information check out this section on creating raw disks in the VirtualBox manual https://www.virtualbox.org/manual/ch09.html#rawdisk.

Warning
Raw hard disk access is for expert users only. Incorrect use or use of an outdated configuration can lead to total loss of data on the physical disk. Most importantly, do not attempt to boot the partition with the currently running host operating system in a guest. This will lead to severe data corruption.

Creating the Virtual Drive:

  1. Connect your hard drive.
    This should be obvious. The first thing you should do is connect up the drive that you need to scan to the host machine.
  2. Find the disk number.
    After you have booted your machine back up you need to find out what number Windows has given to your disk. You can find this information in the disk management pane. First, open the start menu and right click on “Computer”. Select “Manage” from the menu. Next, select “Disk Management” from the pane on the left under the heading “Storage”. In the middle section you will see all of your hard drives and removable media drives listed. At the top of the bottom half should be at least two disks, the first labeled ”Disk 0″. Find the disk number for the drive you want to create the raw disk for (because you can’t use your host machine’s drive as a raw disk, obviously this drive should not have the (C:) partition on it).
  3. Run VirtualBox as an administrator.
    Right click on the VirtualBox shortcut and select “Run as administrator” from the menu. If / when UAC opens a box requesting permission to run, select “yes”.
  4. Open up a command prompt.
    Open the start menu and in the search box type “cmd”. In the list above right click on “cmd.exe” and select “Run as administrator”.
  5. Navigate to the VirtualBox folder.
    Next, you need to navigate to the folder where you installed VirtualBox. For me, this is the default location and since I’m running 64-bit Windows 8.1, the installer installed the 64-bit version of VirtualBox. For me this means I needed to “cd” (change directory) into the regular Program Files folder.

    cd C:\Program Files\Oracle\VirtualBox\
  6. Enter the following command
    To create the raw disk for use with VirtualBox type the following command in the command prompt filling in the file name and the disk number in place of the # symbol:

    VBoxManage internalcommands createrawvmdk -filename "FILENAME" -rawdisk "\\.\PhysicalDrive#"

    Make sure that you include the double quotes around the filename and the disk name. This ensures that if there is a space in your filename that the command uses the entire path.

  7. Create a new VirtualBox VM
    Note: You don’t need to create a virtual hard disk since you are not installing an operating system.
  8. Add the newly created virtual disk to your VirtualBox VM.
    Navigate to the location of the file you created with the command and add it to your VM.
  9. Start up the VM
    Note: You’ll need to run VirtualBox as an administrator anytime you want to run the VM so it can access the drive.

You may also like...