RackNerd Billboard Banner

Boot From a USB Drive in VirtualBox in Linux

Running virtual machines is easy with VirtualBox, but if you want to boot a VM directly from a USB drive—maybe to test a live USB or run a portable OS—it gets a bit tricky, especially on Linux. VirtualBox doesn’t offer a “Boot from USB” option in its UI by default. But it’s still possible, and here’s exactly how you do it.

Why Boot From USB in VirtualBox?

  • Test live Linux distros without rebooting your PC
  • Check or recover data from bootable USB drives
  • Try out portable operating systems

Prerequisites


Step 1: Find Your USB Drive

First, identify your USB drive device path. Open a terminal and run:

lsblk

Look for your USB drive, for example, /dev/sdb (do not use a partition like /dev/sdb1—you want the whole device).


Step 2: Create a VirtualBox VMDK Pointing to the USB

VirtualBox can’t directly use a USB as a boot device, but it can boot from a virtual hard disk file that points to your USB drive.

  1. Close VirtualBox completely.
  2. In your terminal, run (replace /dev/sdb with your actual USB device):
VBoxManage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
  • This command creates a file called usb.vmdk in your home directory, which acts as a pointer to your USB stick.

Step 3: Change Permissions

You’ll need permission to access the USB drive directly.

  • The safest way: run VirtualBox as root (not generally recommended).
  • Better: add your user to the disk group (may require logout/login):
sudo usermod -aG disk $USER
  • Or, temporarily change permissions on the USB drive (less secure):
sudo chmod 666 /dev/sdb

Step 4: Attach the VMDK to Your VM

  1. Open VirtualBox.
  2. Create a new VM (or use an existing one).
  3. Go to Settings → Storage.
  4. Remove any existing virtual hard disk.
  5. Add a new hard disk, and select “Use an existing virtual hard disk file.”
  6. Choose the usb.vmdk file you created.

Step 5: Boot the VM

  • Start the VM.
  • If everything is set up, the VM should boot from your USB drive.

Troubleshooting:


Notes and Warnings

  • Be careful: When a VM uses a raw disk (like your USB), it has full access and can erase or damage data.
  • Only connect one VM to the USB at a time.
  • You may need to repeat the permission step if you unplug/replug the USB drive.

Conclusion

Booting from a USB drive in VirtualBox on Linux isn’t a click-and-go feature, but with a few terminal commands, you can do it reliably. This trick is handy for testing live USBs, running portable OSes, or experimenting with bootable tools—no need to reboot your actual machine.


Have questions or got stuck? Drop a comment below and I’ll help you out!

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
RackNerd Billboard Banner
© 2025 Computer Everywhere
Your Everyday Guide to the Digital World.
Terms of Service | Privacy Policy
Copy link