Booting ISO files in VirtualBox to create a Virtual Machine is pretty much easy, however, what about Virtual Machine USB boot? Yes, I mean suppose you have a bootable USB drive and no ISO file image or anything to boot with to install an OS on VirtualBox; at such condition what will you do? Simple, we can use our bootable USB drive. Although the procedure of doing this is slightly techie as compared to the normal one, easily achievable by anyone.
By default, the VirtualBox doesn’t support USB Flash Drive boot but we can make it run a virtual machine from a flash drive. After following this tutorial, you will be able to boot Windows 10, Ubuntu, Linux Mint, or any OS using USB boot.
Virtual machine boot from USB on a Windows/macOS/Linux Host
Note: Before following any of the below-given methods to install Virtual Machine on VirtualBox using a bootable USB drive, please ensure the VirtualBox is already on your system.
In Windows 10/8/7
Step 1: Find the Bootable USB drive letter
To identify the plugged-in USB drive letter or identification number in the Windows system, press Win key +R, to open the Run box. Type diskmgmt.msc
Step 2: Locate your connected bootable USB Disk drive
On the Disk Management of Windows locate for attached removal drive using which you want to boot and create a VirtualBox Virtual Machine. You can easily identify it as it will be denoted with a Removable text. When you find that note the Disk X letter.
For example, in the below screenshot, our USB drive is labeled as Disk 3, so ‘3‘ is the number that we have to remember. It might be different in your case.
Step 3: Open Command Prompt
On Windows 7/8/10, in the start menu search box typed CMD to search command prompt and when it appears, right-click and select “Run as Administrator“.
Step 4: Switch to Oracle VirtualBox directory
At this step, we enter into Oracle’s VirtualBox installation directory. For that, just copy and paste the below-given command in the Command prompt and press the Enter button.
Step 5: Create USB vmdk -rawdisk
This is a crucial step of the tutorial, as we are going to map a virtual machine (.vmdk file) to the USB Drive. This means we create a VMDK raw file that holds the path of our bootable USB drive for VirtualBox which helps it to recognize the USB drive as a normal Virtual Disk drive.
What you have to do? Just copy-paste the following command in Command Prompt. After that replace the # letter with the drive number which you noted in the second step of this tutorial. For example, our disk number is ‘3’ so we will replace the # letter with 3.
Note: Red color USB2 in the below command is the name of the rawdisk we about to create and you can give it whatever name you want.
VBoxManage internalcommands createrawvmdk -filename C:\usb2.vmdk -rawdisk \\.\PhysicalDrive#
Step 6: Create a New Virtual Machine
Step 7: Assign some name to it.
Here we are creating Windows 7 Virtual Machine with the name USB Windows 7, however, you can select Linux or any other OS depending upon your bootable USB OS.
Allot the amount of RAM you want to give to Virtual Machine.
Step 8: Use USB boot VDMK Raw disk in VirtualBox
In the Hard disk section, select the “Use an existing virtual hard disk file” option and then click on the folder icon which opens Windows Explorer. Now go to C: drive and select your created.VDMK file. In our case it is usb2.vdmk.
Then click on the Create button.
Step 9: Start created a virtual Machine
Select the created USB bootable virtual machine from the right-side panel and click on the Start button given in the VirtualBox menu and that’s it.
If you are using macOS or Linux like Ubuntu then from step 6 to step 9 will be the same, the only difference is the method to create a .VDMK Raw file. For that please see the below steps:
For macOS, USB boot VirtualBox Virtual Machine
Note: VirtualBox should be installed already on the system.
Step 1: Open a Terminal
In the Terminal of MacOS type a command: diskutil list to see all attached disk and USB drives. When the list appears, jot down the bootable USB drive letter (example /dev/disk2) as we have done for Windows above.
Step 2: Unmount USB Disk
To use the USB disk to create a raw image for VirtualBox, first, we have to unmount it. For that the command is:
diskutil unmountDisk /dev/disk#
Note: Replace the # with the USB drive disk number noted above.
Step 3: Create VDMK Raw file of connected bootable USB drive
Use the below command in your MacOS command terminal and again replace the # with the USB disk number.
vboxmanage internalcommands createrawvmdk -filename ~/usb1.vmdk -rawdisk /dev/disk#
After running the above command once again unmount the same disk. As done above, in the same way, replace # with disk number.
diskutil unmountDisk /dev/disk#
Step 4: Run VirtualBox under root access
To run the VirtualBox under root privilege type the below command in terminal
Note: Whenever you want to boot VirtualBox using USB, it should be run under root access.
Step 6: Create a Virtual Machine and assign the created USB VDMK file as a hard disk.
For Linux (Ubuntu 19.04) VirtualBox Virtual Machine USB boot
To install VirtualBox, if not already, the command is:
sudo apt-get install virtualbox
Step 1: List the attached disks
sudo fdisk -l
Step 2: Create USB raw VDMK file
Replace sdbx with the disk name that appeared on your screen. While usb1 is the name of the RAW file that could be anything you want.
vboxmanage internalcommands createrawvmdk -filename ~/usb1.vmdk -rawdisk /dev/sdbx
Step 3: Open the VirtualBox
Type sudo virtualbox in the command terminal to run under root access. When it opens, create a new Virtual Machine.
And at the Hard disk section, select the “Use an existing virtual hard disk” option. Click on the folder icon and select the above-created USB drive raw image file which will be under the home directory. After that just click on the Create button. This will let you perform virtual machine USB boot on Ubuntu Linux.
Other Useful Resources:
- Download & install CloudReady Chromium OS on VirtualMachine
- Way to install Android VM Image on Virtualbox or Vmware