How to boot from a flash drive OS using VirtualBox?
For Windows, see this article : Boot your USB Drive in VirtualBox.
For Linux, the same approach is described in : How to boot from USB in virtualbox on Ubuntu.
The approach is to attach a physical drive to a virtual machine using the VBoxManage command-line tool that comes bundled with VirtualBox. You can then boot your virtual machine from the attached Physical drive.
Alternatively, and only for Windows, Linux Live USB Creator (formerly uSbuntu) is a free software for Windows that allows you to create a bootable Live USB key with a Linux on it. It offers the option of automatic virtualization using portable VirtualBox to directly run Linux in Windows without any configuration nor installation.
Here's a quick summary of the Windows link provided by harrymc, which I discovered independently:
- In Windows 7, open a
cmd
prompt with admin privileges. cd
toC:\Program Files\Oracle\VirtualBox
-
Run the following command:
VBoxManage internalcommands createrawvmdk ^ -filename "C:\usb.vmdk" -rawdisk \\.\PhysicalDrive#
Replace the
#
with the disk number from disk management in computer management (Disk 1 in the image below). Finally, attach the newly-created
vmdk
within VirtualBox as an existing hard drive image.
I know this question is old but I'd like to throw something in. As with other answers I recommend the VBoxManage
command.
However I created a bash script for Ubuntu that simplifies the command and even offers a helpful walkthrough for less comfortable users. It'll help make any changes needed for USB mounting to work (like adding group membership). Advanced users can use flags to avoid the walkthrough.
Check it out here: Use Bootable USB Drives in a VM -- VB Bootable USB Mounter
Yes, in Windows Vista, 7 and 8, you need to start command prompt and virtualbox program as administrator to make this work. Check the latest guide about how to boot virtual machine from bootable USB on Oracle VirtualBox.
according to harrymc's source: you can not set up to boot from USB in the GUI, however, you can create a special virtual disk that only "redirects" to your physical usb pendrive, and attach that. here is the windows way (only, link contains it for linux too).
in windows host
attach your physical usb pendrive to your host computer
open/run
diskmgmt.msc
and check which disk number did windows choose for your physical pendrive:
example:
- then do this in
cmd.exe
:
cd c:\Program Files\Oracle\VirtualBox
VBoxManage internalcommands createrawvmdk ^
-filename <path\to\usb.vmdk> ^
-rawdisk \\.\PhysicalDrive<n>
replace
<path\to\usb.vmdk>
to a path of your choosing, for the "redirect" disk file. example:e:\my_redirect_for_usb.vmdk
replace
<n>
in\\.\PhysicalDrive<n>
with the number of your Physical drive, example:\\.\PhysicalDrive1
if your drive number is 1 (got fromdiskmgmt.msc
above!)aside: note, that
^
only means "line-continuation" incmd
- i did this only for better readability. You can write the whole thing in one line, instead -- just leave out any^
, then.now you can attach the vmdk (example:
e:\my_redirect_for_usb.vmdk
) in Virtualbox like you do with any other hdd imageI managed to boot this way in 2014 :) ( -- the source article is from 2009)