Saturday, November 17, 2012

How To Configure VirtualBox (4.2.x) To Boot From A USB Device Under Ubuntu/Linux Mint



In this tutorial, we will see how to make VirtualBox (v4.2.x or older) boot from USB devices under a system running Ubuntu/Linux Mint. The method that we will use consists of mapping the USB device as a virtual disk and then mount it with VirtualBox.

If you haven't installed the latest version of VirtualBox under Ubuntu 12.10/12.04/Linux Mint 13, then do with the following commands:


 echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list 
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add - 
sudo apt-get update 
sudo apt-get install virtualbox-4.2

1. Identifying Your USB Device

Connect your USB drive to your computer/laptop, then open the terminal and run this command:

 fdisk -l

or

 df -h

For my system, the USB stick is identified as /dev/sdb1:


Change /dev/sdb1 to your own usb flash drive name in the commands below.

2. Unmounting The USB Device

Via the terminal, run these commands:

sudo umount /dev/sdb1 
sudo chmod 666 /dev/sdb1

3. Boot From USB Device Under VirtualBox

Run now this command to map your usb drive as a disk image so that it can be mounted by VirtualBox:

VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/usb.vmdk -rawdisk /dev/sdb1

The command above will create a disk image named usb.vmdk that will be associated with your USB flash drive (/dev/sdb1). Now, you can attach this vritual disk (usb.vmdk) to any of your current virtual machines.

No comments:

Post a Comment