How to Boot from a USB Drive in VirtualBox


The usual way to install an operating system in VirtualBox is through an ISO file or the CD/DVD drive, but do you know that you can also boot from a USB drive in VirtualBox? A lot of people are not aware of this feature simply because it is hidden and is not available in the GUI. In fact, you will have to open the Terminal (or command prompt) and use the VBoxManage command to access this feature. In this guide, let us see how you can boot (or install an OS) from a USB installer in VirtualBox.
Note: This tutorial is done on a Windows machine. The steps might differ for Linux/Mac.
Assumption: This tutorial assumes that you already have a bootable USB drive with some sort of operating system (most probably a Linux distro) installed in it.
Before doing anything, launch your Windows system and plug in your bootable USB drive. Now we need the disk number of that bootable USB drive.
Note: Do not confuse the disk number with the drive letter. They are not the same.
We can find out the disk number from the Windows Disk Management utility or any other third party disk management or partition utility. For now, let us use the Windows utility. Press “Win + R”, type diskmgmt.msc and press the Enter button.







boot-from-usb-virtualbox-run-command

Look for your USB drive and remember the Disk number. In my case, the USB drive is listed as “Disk 1,” so the disk number is “1.”

boot-from-usb-virtualbox-disk-number

Once you have the disk number, open up the Windows command prompt as administrator.
boot-from-usb-virtualbox-cmd-as-admin

Navigate to the VirtualBox installation directory using the following command. If you have installed VirtualBox in any other directory or drive, then change the command accordingly.
cd %programfiles%\Oracle\VirtualBox
 
boot-from-usb-virtualbox-navigate

Enter the following command while replacing “#” with the actual disk number. What this command does is create a VMDK file in your C drive which points to the physical USB drive.
VBoxManage internalcommands createrawvmdk -filename 
C:\extdisk.vmdk -rawdisk \\.\PhysicalDrive#
Once you have replaced the drive letter, the command should look something like this.
 VBoxManage internalcommands createrawvmdk -filename 
C:\extdisk.vmdk -rawdisk \\.\PhysicalDrive1
 
boot-from-usb-virtualbox-execute-command

Once you execute the command you will get a confirmation message stating the same, and you will see a new file with the name “extdisk.vmdk” in your C drive.

boot-from-usb-virtualbox-vmdk-file-created

Now open up the VirtualBox with administrative rights. If not, VirtualBox will fail to boot from the USB drive.

boot-from-usb-virtualbox-open-virtualbox-as-admin

Once opened, create a new virtual machine as usual. At the step when it prompts you to add a hard drive, select the radio button “Use an existing virtual hard drive file.” Click on that little folder icon and select the file we just created. Click on the “Create” button to complete the process.

boot-from-usb-virtualbox-select-vmdk-file

You will see a new virtual machine listed in the left pane of the VirtualBox window. Just select it and click on the “Start” button located in the top menu to boot from the USB drive. As you can see from the image below, I’ve successfully booted into my XP drive.
http://download.virtualbox.org/virtualbox/5.0.8/VirtualBox-5.0.8-103449-Win.exe


Post a Comment

Dear Visitor Your Comments Improve After 24 Hours Thank You

 
Top