Home FAQ How To Boot From USB Drive In Virtualbox In Linux

How To Boot From USB Drive In Virtualbox In Linux

By sk

Yesterday I was trying to create multiboot USB drive with Ventoy in my Linux system. After successfully created the bootable drive, I added different ISOs to the bootable drive. But the problem is I had to reboot my  system every time after adding a new ISO to check if the USB drive is really working. Since I had no additional system, It seemed a little bit time consuming task to me. I thought it would be better If I could boot from USB drive in Virtualbox in my Linux system. As you might know, Oracle Virtualbox doesn't offer any direct way to boot from USB. Luckily, I have found a simple workaround to allow Virtualbox to boot from an USB flash drive.

Boot From USB Drive In Virtualbox In Linux

To allow Virtualbox boot from USB drives, you need to create a .vmdk file and point it to your USB drive for booting to it. For those wondering, a vmdk file is nothing but a virtual disk file which contains all the information of a virtual machine.

First, you need to find your USB drive name. Refer the following guide to learn different ways to find disk drive details in Linux.

I am going to use "fdisk" command to find my USB drive details:

$ sudo fdisk -l

Sample output:

Disk /dev/sdc: 14.54 GiB, 15597568000 bytes, 30464000 sectors
Disk model: Cruzer Blade    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4d924612

As you can see, my USB drive name is /dev/sdc.

Now, open your Terminal and run any one of the following commands to create a vmdk file:

$ sudo vboxmanage internalcommands createrawvmdk -filename  ~/usb.vmdk -rawdisk /dev/sdc

In some Linux distros, the vboxmanage command is case-sensitive. In that case, use the following command to create vmdk file:

$ sudo VBoxManage internalcommands createrawvmdk -filename  ~/usb.vmdk -rawdisk /dev/sdc

The above command will create a new vmdk file named "usb.vmdk" in your $HOME directory. Upon successful vmdk file creation, you will see an output like below:

RAW host disk access VMDK file /home/sk/usb.vmdk created successfully.

Create new vmdk file using vboxmanage command

Set proper permission to the newly created vmdk file:

$ sudo chown $USER:$USER ~/usb.vmdk

Next, add your user to "vboxusers" and "disk" groups using the following commands:

$ sudo usermod -a -G vboxusers sk
$ sudo usermod -a -G disk sk

Replace "sk" with your own user name.

Please be mindful that adding a user to "disk" group is dangerous and security risk. Now remove the USB drive and reboot your system to take effect the changes. If you don't remove your USB, the name of your drive letter may change at next boot. So it is important to remove the USB first and reboot the system.

Now open Oracle Virtualbox application and create a new virtual machine:

Create new virtual machine in virtualbox

Enter the name of the VM, OS type and version and click Next to continue:

Enter virtual machine details in virtualbox

Enter RAM size:

Enter RAM size to virtual machine in virtualbox

This is important step. Choose "Use an existing virtual hard disk file" option and click the browse button (UP arrow button):

Use an existing virtual hard disk file

Click "Add" button to choose the newly created vmdk file:

Click "Add" button to choose the newly created vmdk file

Choose the newly created vmdk file from your local drive:

Choose the newly created vmdk file from your local drive

After adding the vmdk file, click Choose button to confirm:

Confirm adding the vmdk file

You will now see the vmdk file is selected as the virtual hard disk for the new virtual mahine. Click Next to continue:

vmdk file is selected as the virtual hard disk

All done! Plug your bootable USB drive and start the virtual machine:

Boot from USB drive in Virtualbox

Now you can be able to boot from USB in Oracle Virtualbox. Here I am booting the USB bootable drive created with Ventoy script in Virtualbox:

Boot From USB Drive In Virtualbox In Linux

Create An ISO From A Bootable USB Drive In Linux

This is another way to boot USB drive in Virtualbox. In this method, we don't need to create vmdk file. Just create an ISO image from the bootable USB using "GNOME disk utility" or "dd" command as described in the following link:

After creating the ISO, open Virtualbox application and go to the Settings of the any VM and add (mount) this newly created .iso file as an optical drive under "Storage Controller: IDE" option.

Add ISO in virtualbox storage controller

Now start the VM and it will boot from the ISO image.

Please note that this method will not work with all USB images, especially with multi-partitioned USB drives.

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like


Bill Donnelly May 26, 2020 - 11:51 pm

could not get the usb.vmdk file to load into virtualbox due to permissions issue. Could you help me with this?

sk May 27, 2020 - 5:44 pm

Set permissions for your user as described in the guide and also reboot the system.

$ sudo chown $USER:$USER ~/usb.vmdk
$ sudo usermod -a -G vboxusers sk
$ sudo usermod -a -G disk sk

Replace “sk” with your username.

Nash June 26, 2020 - 5:20 am

I used this tutorial to install Windows 10 in VB on Linux Mint. I thought I had it to where I wouldn’t need the USB to start windows, but it will only start that way. How can I move the files to the pc and direct the virtual storage to them so I can boot natively?

I know common sense is to just restart booting from an ISO, but I’m trying to learn more about how everything works. My original goal was to install windows 10 to vm through usb.

sk June 26, 2020 - 11:38 am

I don’t know any direct way to do this. If I were in this situation, I would create an ISO of the USB drive and install Windows using the ISO. https://ostechnix.com/create-iso-bootable-usb-drive-linux/


Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More