How to Boot From a USB Flash Drive in VirtualBox
How to boot from a USB Flash Drive in VirtualBox. This process will allow you to run your Portable Linux from the USB Flash Drive or external hard drive while still running from a Windows, Linux, or Mac OS X Host. By default VirtualBox does not support USB Boot. However this is easily attainable by mapping a virtual machine (.vmdk file) to the USB Drive.
VirtualBox Website: https://www.virtualbox.org
Boot a USB Flash Drive from VirtualBox (Windows Host)
- Download and Install VirtualBox (Install to the default path)
- Click Start > Run Type
diskmgmt.mscand click OK (In Vista/Win7 use the Start > Search Box)
(1) Locate your USB Disk #

- Open a command prompt
cmd.exe(run as admin in Vista/Win7) - Type
cd %programfiles%\oracle\virtualbox - Type the following (replace # with your USB Disk number from step 2)
VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%"\.VirtualBox\usb.vmdk -rawdisk \\.\PhysicalDrive#
- Start VirtualBox (run as admin in Vista/Win7) and create a New Virtual Machine

- When prompted for a Virtual Hard Disk, tick use existing hard disk and select usb.vmdk

- Once you've finished creating your New Virtual Machine, click Start

If all goes well, VirtualBox should now be running the Linux version installed on your USB device emulated from within Windows.
Boot from a USB Flash Drive in VirtualBox (Linux Host)
The following was performed from a running Ubuntu Operating environment. The same should work for most Debian/Ubuntu Linux based environments.
- Open a Terminal and type
sudo apt install virtualbox
(Or you can visit the virtualbox download section for other options) - Type
sudo fdisk -l(note which device is your USB drive I.E. /dev/sdb) - Type
vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdx(replacing sdx with your actual drive letter from step 4) - Type
virtualboxto start the program, and proceed create a New Virtual Machine
- When prompted for a Virtual Hard Disk, tick use existing hard disk then browse to your Home directory and select usb.vmdk

- Once you've finished creating your New Virtual Machine, click Start

If all went smoothly, you should now be booting your USB flash drive from VirtualBox on the Linux Host.
Boot from a USB Flash Drive in VirtualBox (Mac OS X)
- Download and install the VirtualBox for OS X Hosts via the .dmg file.
- Open a Terminal and type
diskutil list(note which is your USB drive I.E. /dev/disk2) - Type
diskutil unmountDisk /dev/disk#(replacing # with the disk number of your USB drive)
Typevboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/disk#(again replacing # with your actual disk number) - Type
diskutil unmountDisk /dev/disk#(once more replacing # with the disk number of your USB drive) - Type
sudo virtualboxto start the program with root access (note: you'll need to usesudo virtualboxfrom a terminal every time you want to boot from the usb). - Proceed create a New Virtual Machine
When prompted for a Virtual Hard Disk, tick use existing hard disk then browse to your Home directory and select usb.vmdk
- Once you've finished creating your New Virtual Machine, click Start

If all went well, you should now be booting your USB flash drive from VirtualBox on the Mac OS X Host.



