October 10, 2024

VirtualBox by default has no clear option for booting from USB drives when creating Virtual Machines (VM).

There is a workaround for this though. It requires mapping the physical USB drive as a Virtual Hard Drive (VHD) file and then setting it as the hard disk for the VM.

Here is how to do this:

Find the USB drive details:

With the USB drive plugged in, open Disk Management by typing in the Run box:

 diskmgmt.msc

access disk management from Windows Run box

This displays all the Windows disks and partitions along with external devices like USB drives.

listed drives and partitions in Windows Disk Management

Note down the number next to the plugged-in USB drive (1 in this example as the drive is listed as Disk 1 Removable).

Create a VHD file:

Now, open the Windows command prompt as an administrator.

open the command prompt as administrator

Go to the path where VirtualBox is installed, the default usually is in the Program Files\ Oracle\VirtualBox folder. To create a VHD that maps to the USB drive, use the VBoxManage createmedium as follows:

create a VHD file for the USB drive in VirtualBox

 VBoxManage createmedium disk --filename C:\BootUSB.vmdk --variant=RawDisk --format=VMDK --property RawDrive=\\.\PhysicalDrive1

In this example, it will make a VHD file named BootUSB.vmdk that is mapped to Drive 1 (USB). A detailed syntax on how to use the VBoxManage createmedium command can be found here.

The earlier command to do this was createrawvdk, but that is now deprecated and this is the new one.

Now all you need to do is set it as the boot device when creating a new virtual machine.

Select the VHD file as the VM hard drive:

For this, when configuring a new VM, scroll down to the Hard Disk section and instead of making a new virtual hard disk, choose the option Use an Existing Virtual Hard Disk File.

making a virtual machine in VirtualBox

VM hard disk selector in VirtualBox

This will open the Hard Disk Selector and it will now have the USB drive listed to choose from.

Select it and finalize setting up the VM. It will now boot from that USB drive.

choosing the USB drive as the VHD for VM

All done.

By admin

Related Post

3 thoughts on “How To Boot From USB Drives In VirtualBox”
  1. Very good and helpful, thank you. I just was looking for this.
    In the example in the code box there are two dashes missing at the arguments ‘format’ and ‘property’: “… -format=VMDK -property RawDrive= …”

    It should be: “… –format=VMDK –property RawDrive= …”

Comments are closed.