The GUI of VirtualBox does not have an option to boot a USB drive (Physical Drive) in a virtual machine.
However you can attach a physical drive to a virtual machine using a command line tool that is bundled with Virtual Box.You can then boot your virtual machine from the attached Physical drive.You need to use VirtualBox with Windows installed in order to use the software for a o2 mobile broadband dongle. As you are probably aware, you are unable to use it with Linux.
This is the continuation of my previous article Test bootable USB drive without restarting your computer.You can read more about bootable usb drives in that article.
Note:This tutorial has been updated for Virtualbox 4.
In this article I will show you how you can boot a bootable usb drive in Virtual Machine created by VirtualBox.You can easily test bootable USB drives within Windows or Linux and without restarting using this method.
Download and install Virtual Box and VirtualBox 4.0.2 Oracle VM VirtualBox Extension Pack from http://www.virtualbox.org/wiki/Downloads
The Extension pack adds support for USB 2.0 devices.
Attaching a Physical Disk to a Virtual Machine
Section 9.6 in the VirtualBox manual contains all the details required to attach a physical disk to a virtual machine.Using the vboxmanage.exe tool you can create a tiny vmdk file which points to your real USB drive (Physical Drive/Disk).You can attach this tiny vmdk to your virtual machine.A vmdk file is a virtual hard disk file which can be used with VirtualBox and VMWare.
The vboxmanage.exe tool is bundled with VirtualBox.You don’t have to download it separately
Open Command Prompt
Navigate to your Virtual Box installation Directory.
cd "c:\Program Files\Oracle\VirtualBox"
Type the following command and press enter
Syntax of the command
VBoxManage internalcommands createrawvmdk -filename path\to\usb.vmdk -rawdisk \\.\PhysicalDrive1
You have to replace pathtousb.vmdk with the path of your choice
Example
VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%\usb.vmdk" -rawdisk \\.\PhysicalDrive1

In Windows your 1st Hard Disk will be \.PhysicalDrive0.Your 2nd Hard disk will be \.PhysicalDrive1.
Warning:Do not Attach your Primary hard disk to your Virtual Machine and Boot it in the Virtual machine
To find the correct number for your USB Drive
Right Click on My Computer-Manage-Disk Management
Here you can find the correct disk number of your USB Drive

You will have to replace \.PhysicalDrive1 with the correct drive number.
In this case there was only 1 hard disk and 1 USB disk.So the USB drive is referred by \.PhysicalDrive1
In linux you have to replace \.PhysicalDrive1 with the correct /dev/sdx reference.
Now you should have a tiny vmdk file.You can start your Virtual Machine with this tiny vmdk and boot from it.
- Start VirtualBox.
- Create a new Machine or Select an Existing Machine.
- Click on Settings

- Storage-Add Hard Disk

- Select the vmdk file that you had created.


- Make sure that usb.vmdk is your Primary Master.

- System-Boot Order.Set your Hard Disk as the first boot device.
- Now start your Virtual Machine.
Your virtual machine will boot from your bootable physical USB Drive.
In this screenshot I have used a bootable Ubuntu USB drive created using Unetbootin.



Use plop bootmanager its way easier
Tried this using Ubuntu 11.04 host and Virtualbox 4.1
Virtualbox refuses to use the .vmdk file giving an error…
NS_ERROR_FAILURE (0×80004005)
Tried changing permissions, etc.
Any thoughts?
In linux you have to be root if you want to access /dev/sdfX
I wasn’t very clear…
I mean you have to be root to access /dev/sdfX, so virtualbox must be running as root (or sudo) to access your usb drive.
Your vmdk file is like a “pointer” to /dev/sdfX… at least as I undestand it…
This don’t work. Keeps flipping “Invalid parameter” in the image path. llameeeeeee
How to boot from USB in another Computer which have xp installed using virtualbox?
Works on windowsxp. I try install ubuntu 11.10. Thanks
it is a good tutorial. but in both the cases ie to create usb.vmdk and load it as hard disk in new machine, the cmd.exe and virtualbox must be run with administrator rights. this was the mistake i did at first.
DOES NOT WORK!
VB says the file is inaccessible. However, the CLI program claims to have succeeded in creating the USB.vmdk. and i checked. so why say its not accessible??? any answers?
It appears that you need to run virtualbox as admin (sudo) to access raw disks:
http : // luckyviplav.wordpress.com/2010/07/17/windows-7-on-mac-os-x-through-virtual-box/
See the comments by Marcos Vives.
Cheers,
ak.
Superb! Tested and works with VirtualBox 4.1.2 on Win7 x64 as a host. Booting a 32Gb Transcend JF V60 which was made bootable with Diablerie’s Ultimate Suite…