Boot your USB Drive in VirtualBox

Blog - Programming

User Rating: / 1
PoorBest 

Written By Bharat Balegere. On Jul 25. In Agni Karya,usb

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.You can read more about bootable usb drives in my previous article.

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 and without restarting using this method.

Warning:Do not Attach your Primary hard disk to your Virtual Machine and Boot it in the Virtual machine

Download and install Virtual Box from here http://www.virtualbox.org/wiki/Downloads

Attaching a Physical Disk to a Virtual Machine

Section 9.10 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”\Sun\”xVM VirtualBox”

Type the following command and press enter
Syntax of the command
VBoxManage internalcommands createrawvmdk -filename pathtousb.vmdk -rawdisk \\.\PhysicalDrive1 -register
Example
VBoxManage internalcommands createrawvmdk -filename c:UsersAgni.VirtualBoxVDIusb.vmdk -rawdisk \\.\PhysicalDrive1 -register

You have to replace pathtousb.vmdk with the path to your VDI folder(Where all your virtual hard disks are stored).If you want to save your usb.vmdk in different location,then you will have to add the usb.vmdk file manually in the GUI.This is because the register switch only registers the virtual hard disks stored in the User ‘s VDI folder .

keygdy Boot your USB Drive in VirtualBox

In windows your 1st Hard Disk will be \\.\PhysicalDrive0.Your 2nd Hard disk will be \\.\PhysicalDrive1.

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

Drive Number of the Physical Drive

Drive Number of the Physical 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/sda reference.

Now you should have a tiny vmdk file.You can start your Virtual Machine with this tiny vmdk and boot from it.

  1. Start VirtualBox.
  2. Create a new Machine or Select an Existing Machine.
  3. Settings-Hard Disk-Add-Select usb.vmdk
  4. Make sure that usb.vmdk is your Primary Master.
    29prsch Boot your USB Drive in VirtualBox
    hx5a41 Boot your USB Drive in VirtualBox
    2zdykok Boot your USB Drive in VirtualBox
  5. System-Boot Order.Set your Hard Disk as the first boot device.

    555948 Boot your USB Drive in VirtualBox

    Boot Order

  6. Now start your Virtual Machine.

Your virtual machine will boot from your bootable physical hard disk.

In this screenshot I have used a bootable Ubuntu USB drive created using Unetbootin.

2jfiy39 Boot your USB Drive in VirtualBox

1470ut Boot your USB Drive in VirtualBox

121bekz Boot your USB Drive in VirtualBox



Add this page to your favorite Social Bookmarking websites

Add comment


Security code
Refresh

Idioms

  • There's no rose without a thorn (Hồng nào mà chẳng có gai)
  • Every day is not saturday. (Sông có khúc, người có lúc)

Who's online

We have 8 guests online

Location

 38.107.179.218
 38.107.179.218
Search Bot
 unknown unkno

Relax

Site Ranking


Increase your website traffic with Attracta.com

Quick Search

This Day in History

Poll

What is your current operating system?
 

Weather

Newsletter

Copyright © 2012 Thong D. Nguyen. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.