This article shows how to boot from USB in VirtualBox with Ubuntu 22.04 | 20.04. As you may know, Oracle Virtualbox does not provide any direct way to boot from USB. Luckily, I found a simple solution to allow the Virtualbox virtual machine to boot from a USB flash drive.
How to Boot USB in VirtualBox on Ubuntu 22.04 Virtual Machines
First, the required condition is that you must have a bootable USB. Of course :D. You can use Rufus software or refer to some articles:
- How to install windows 11 create boot USB with Rufus
- How to create USB Boot UEFI-Legacy Multipurpose Hidden Partition
To allow Virtualbox (boot) to boot from a USB drive, you need to create a *.vmdk file and point it to your USB drive to boot. The file vmdk
here will be a virtual disk file containing all the information of a virtual machine operating on VirtualBox with Linux. Now let’s get started.
1. Create file *.vmdk to boot from the USB
First, to boot from USB in VirtualBox with Ubuntu 22.04 | 20.04, you need to find the name of your bootable USB drive, connect the USB and open the terminal then run the command below, I will use the fdisk
command to list and search my USB drives:
sudo fdisk -l
Looking at the image above as you can see, I have 1 32GB USB drive and the name found is /dev/sdb
. Now, open the terminal and run the command to create the vmdk
file.
sudo vboxmanage internalcommands createrawvmdk -filename ~/Downloads/usb_boot.vmdk -rawdisk /dev/sdb
In the above command, ~/Downloads is where I saved the usb_boot.vmdk file, you can specify a location to save the file on your device.
2. Set Permission for file *.vmdk USB bootable
Next, after the usb_boot.vmdk
file has been created, you need to set the appropriate permissions for it.
sudo chown $USER:$USER ~/usb_boot.vmdk
Next, add your user to the vboxusers
and disk
groups with the following commands:
sudo usermod -a -G vboxusers itsmeit sudo usermod -a -G disk itsmeit
Replace “itsmeit” with your user, you can type who command to see.
Note: how to boot from USB in VirtualBox with Ubuntu 22.04 | 20.04 & Linux successful, disconnect the USB drive and reboot your computer for the change to take effect. If you don’t remove your USB, your drive letter name may change on the next boot. So it is important to remove the USB first and reboot the system.
3. Set up VirtualBox and boot to USB on Ubuntu 22.04 | 20.04
Now open the Oracle Virtualbox application and create a new virtual device. You can read more articles on how to install VirtualBox on Ubuntu 20.04 | 22.04 LTS if Virtualbox is not installed.
Click on the New icon, Then give the virtual machine a name, OS type, and version and click Next to continue. Here I will create a virtual device to install windows 11 on VirtualBox.
Set up RAM for the virtual device and continue to click Next.
At the important step, Select “Use an existing virtual hard disk file” and navigate to the usb_boot.vmdk
file created earlier. Click the “Add” button then navigate to the usb_boot.vmdk file and click Choose as shown below.
Click Create after completing the setup.
Finally, click the Start button to perform a USB boot into VirtualBox.
Above are the steps on how to boot USB on VirtualBox running on Ubuntu 22.04 operating systems | 20.04 & Linux. If you have any questions, please leave a comment below.
— Read more: How to clean up junk files on Ubuntu 22.04 | 20.04 LTS
– Advertising –