This document shows how to use a Ventoy formatted USB device (instead of an optical disk) to boot an ISO image in VirtualBox. There are other HowTo documents on the internet that explain this procedure (one is mentioned in the References section below), but most use a deprecated VBoxManage sub-command to create the raw device. This document uses the preferred createmedium sub-command. It also uses PowerShell rather than cmd.exe.
The generic form of the command that makes the Ventoy USB drive available to VirtualBox is as follows:
.\VBoxManage createmedium disk --filename=PATH --format=VMDK --variant=RawDisk --property RawDrive=DEVICE_NAME
But, there are some prerequisites...
- You must be using a Windows Terminal PowerShell session with admin privileges.
- You must be in the correct directory to execute the VBoxManage command.
- You need to determine the PATH that will represent your USB flash drive.
- You need to know the Windows DEVICE_NAME of your USB flash drive.
There are many ways to do this. The steps below will get you there quickly.
- Use the key combination of Windows Key + X to open the quick link menu.
- Select Terminal (Admin) from the list of choices.
- Respond with Yes when the User Account Control dialog appears.
If you installed VirtualBox to the standard Location, the necessary executables will be under C:\Program Files\Oracle\VirtualBox. You can get there using the PowerShell command: cd $env:programfiles\Oracle\VirtualBox
If you customized the installation location, you'll need to find it and change directory to there before proceeding.
Verify the location by running .\VBoxManage createmedium disk with no command-line parameters. You should see a command usage summary. If you get an error instead of the summary, you're in the wrong directory.
In this example, we'll use C:\Program Files\Oracle\VirtualBox
This is the full path name of Virtual Machine Disk (VMDK) file that represents the flash drive. A simple example would be to use C:\USB_Flash_Drive.vmdk or something similar. You may also want to place it in a subdirectory.
Ultimately, where it goes and what it's called is entirely up to you. Just make the path easy to remember, because you'll need to know it later when setting up a virtual machine that uses it.
In this example, we'll use the path C:\FlashDrive.vmdk
Use the Get-PhysicalDisk command to show all disks on the system and visually identify which one is the USB flash drive using its friendly name. Once the DeviceID is known, we can construct the device name by prepending \\.\PhysicalDrive
The command below shows how to isolate the fields of interest.
Get-PhysicalDisk | Select DeviceID,FriendlyName
DeviceID FriendlyName
-------- ------------
1 SanDisk Cruzer Glide
0 NVMe BM9C1 Samsung 1024GB
In this example, we see the SanDisk Cruzer Glide with a Device ID of 1. This is the USB flash drive.
The device name in this case is \\.\PhysicalDrive1
With all the prerequisite parameters gathered, it's time to run the command. The example below shows the command constructed using the prerequisites identified in the steps above. Your command parameters will likely be different.
cd C:\Program Files\Oracle\VirtualBox
.\VBoxManage createmedium disk --filename=C:\FlashDrive.vmdk --format=VMDK --variant=RawDisk --property RawDrive=\\.\PhysicalDrive1
This command should output "Medium created." along with a UUID if all is successful.
After creating the VMDK representing the USB flash drive, you can run VirtualBox Manager and navigate to Tools, Media to see FlashDrive.vmdk. This represents your USB flash drive and can now be attached to any virtual machine as a hard disk.
NOTE: You must run VirtualBox as administrator or you will not be able to access the USB flash drive.
https://www.howtogeek.com/187721/how-to-boot-from-a-usb-drive-in-virtualbox/
https://www.virtualbox.org/manual/UserManual.html#adv-storage-config
Below is some abreviated output from VBoxManage that shows the USB flash drive attached to the SATA controller.
PS C:\Program Files\Oracle\VirtualBox> .\VBoxManage.exe list vms
"Alpine" {e8e50bff-340b-487e-b773-ac4795ae800b}
PS C:\Program Files\Oracle\VirtualBox> .\VBoxManage showvminfo Alpine
Name: Alpine
...
Storage Controllers:
#0: 'SATA', Type: IntelAhci, Instance: 0, Ports: 2 (max 30), Bootable
Port 0, Unit 0: UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Location: "C:\Users\dave\VirtualBox VMs\Alpine\Alpine.vdi"
Port 1, Unit 0: UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Location: "C:\FlashDrive.vmdk"
...