By any chance you need to boot a virtual machine in Oracle VirtualBox with a bootable Operating System or program utility, then this small guide would be helpful. In this article, I show you how to boot a virtual machine from a physical USB drive (flash disk) which is connected to the Windows 7 host computer.
Oracle VirtualBox is one of the best and free desktop virtualization software which allows running multiple Operating Systems on the single computer. Nowadays, most of the PC utilities and Operating Systems have the feature to create bootable USB disk which can be used in varies ways. VirtualBox is not supporting direct USB boot for a virtual machine as it is supporting CD/DVD and ISO boot. So, here is the workaround to boot a virtual machine from USB disk on VirtualBox.
Basically, we need to create a raw VMDK file pointing to USB disk, which is similar to our earlier guide how to access physical disk and partition from VirtualBox virtual machine.
I’m demonstrating these steps on a Windows 7 host computer and an bootable DOS OS USB flash drive is connected to it. I’m going to boot an existing VirtualBox virtual machine from attached USB disk.
1) Make sure your USB is bootable and it is booting on a physical computer. Because, if the USB is not bootable, no point in blaming these steps or VirtualBox.
2) Find out the attached USB disk’s correct disk number from Windows Disk Management.
Here is mine. Disk 4 is the USB I need to boot from VirtualBox.
3) Let’s create a raw VMDK file for the USB disk.
Open the command prompt as administrator ( in Windows Vista, 7 and .8) and go to the installation directory of VirtualBox (usually it will be located under program files folder).
Important Note – You must open the command prompt by selecting ‘Run as administrator’ option.
Type the following command.
VBoxManage internalcommands createrawvmdk -filename C:\\Users\\Dinesh\\Desktop\\usb1.vmdk -rawdisk \\\\.\\PhysicalDrive4
You must enter the valid path to save output VMDK file and make sure you are typing the correct disk number for USB drive which we found out in step 2.
A successful message should appear as below if the command works fine.
4) Open VirtualBox as administrator ( Right click – Run as administrator) and go to the settings of the virtual machine you like to boot from USB disk.
We need to attach the VMDK file which was created in step 3. Also, it should be the first hard disk to be able to boot. Since my existing virtual machine is having SATA controller, I have clicked on Add Hard disk and selected Choose existing disk. Browse the VMDK file we created earlier.
Once the disk is added without any error messages, you may need to change the SATA ports or IDE settings to make the added hard disk as the first boot disk, otherwise, it will be booting from earlier OS hard disk only.
5) Now you can switch on the virtual machine, it should boot from attached USB disk.
Here is my Fedora 17 virtual machine booted with DOS OS installed USB flash drive.
The involved steps are very easy and straightforward, only important part is you must open the command prompt and VirtualBox program as administrator to make this work.