How to use USB in VirtualBox
Sometimes the user urgently needs to connect the USB flash-drive or hard disk to the virtual machine. Despite all the manual efforts, he is just not capable to do it on his own, and in this case my instruction will be especially helpful. In this note I will in detail explain, how to connect USB-device to VirtualBox. Also I will mention, how to boot from USB drive in VirtualBox, and how to do it easily and simply.
One of the main preconditions for performing this manual is prior setting up of Oracle VM VirtualBox app, VirtualBox Guest Additions package and VirtualBox Extension Pack onto your PC. I will not clarify how to install most of this software, except Extension Pack. Just make sure, that all of the defined plugins are configured and customized before continuing the basic procedure.
How to install VirtualBox Extension Pack on the VM?
Extension pack is a set of utilities designed to enhance the interaction between the user and the virtual machine. The procedure of installing the package is absolutely elementary and intuitive. One primary condition – the package should be installed in VirtualBox, i.e. when the VM is running. At first we need to surf the web in search of the extension package, visit the official VirtualBox FTP-server and download the corresponding installation distributive from there. The link goes right here: http://download.virtualbox.org/virtualbox. Check out the active version of your current VirtualBox installation. In order to bring this intention to life, click Help -> About VirtualBox item in the upper menu.
Now the setting up routine is over and we may continue with the basic procedure.
How to use USB drives in VirtualBox guest OS?
The latest VirtualBox version supports USB 3.0 devices. In order to be capable to get the whole bonuses of using USB 3.0 speeds, you will have to install Extension Pack, as we defined it earlier. Otherwise, the maximum transfer speed of the data will be equal to 12 Mbit/s, which is valid for USB 1.0 controller. In other case, the USB-disk may not be initialized at all, so let’s not forget about such a circumstance.
At first, before running the virtual machine, address to the main menu of the VM and open the “Settings” category, appropriate for the used machine instance. When the form opens, move to the “USB” section and put on the “Enable USB Controller” and “USB 2.0 (EHCI) Controller” checkboxes. Also create a filter for the required USB-device, specifying it in the list of all available USB-drives, either external hard disks or flash-drives.
After that the USB-drive will be immediately attached and initialized.
How to boot OS from USB on VirtualBox?
Whatever weird it may seem to you, but you may boot guest OS from USB-drive on VirtualBox. Lower I will present the instruction how to do it from Windows host.
Actually, booting from USB is a hidden feature in VirtualBox, which guarantees raw access to drives. This functionality isn’t available in app basic interface, but it’s a part of the VBoxManage command.
The first step, which you should perform prior to booting the external OS from USB-drive, is to connect the appropriate USB-drive with OS installed in it, to the PC. Use Windows + R hotkey combination, type diskmgmt.msc in the Run dialog form and press Enter button. As a result, the Disk Management window will be opened.
Now, close any opened VBox application forms.
Enter the mentioned command into the command line and press Enter button. This command is dedicated to changing the active path to the VirtualBox default installed path. If you set up the app into the different folder, you will have to specify your own directory instead of mentioned in the example. cd %programfiles%\Oracle\VirtualBox
Enter the defined command in the command line, replacing # sign with the number of the disk you noted earlier in the Disk Management form, and then press Enter button.
VBoxManage internalcommands createrawvmdk –filename C:\usbdisk.vmdk -rawdisk \\.\PhysicalDrive#
Instead of C:\usbdisk.vmdk you can specify any path you desire. As a result of this command, the VMDK-file will be created, which points to the physical drive you select. After you load the VMDK-object as a drive in VirtualBox, actually the VM will get access to the physical disk of your HDD.
After this iteration is completed, open VirtualBox as administrator. Make a right click on the app shortcut and choose Run as administrator in the context menu. The virtual machine may get access to raw disk drives only with admin rights.
When the request is standing visible on the screen to define a hard disk, choose Use an existing virtual hard drive file option, make a click on the button to select a file on the hard disk, and search it – that will be C:\usbdisk.vmdk if you didn’t specify your unique path.
Pay attention to the following fact: the USB device should be the first hard disk in your VM settings, otherwise VirtualBox won’t load from it. Talking in another words, you are not able just to generate a default VM and attach a USB-drive afterwards.
As you can see, beforehand I precisely described, how to use USB devices in VirtualBox. This article will surely come in hand, if you decide to boot from USB in VirtualBox or to attach an external USB drive to the VM.