These instructions are for VirtualBox 4.1.18 running on Windows 7 with Service Pack 1 with Ubuntu 12.04 (running the Unity Interface) as the guest OS.
I believe the instructions are the same (or very similar) regardless of which host OS and guest OS combination you are running, but I make no guarantee.
Sometimes you want to (or need to) directly access a USB device, like a memory stick, or a printer, or camera.
Normally, VirtualBox does not provide access to these devices, however, it is possible to allow the guest OS to directly access the USB device.
(I needed to allow Linux to directly access a SD card so I could use the dd
command to copy a OS image. This turned out to be very slow. I am not sure if this was because I was accessing it via VirtualBox or because dd
is inherently slow writing to flash cards.)
NOTE: when a USB device is used by VirtualBox, the device will no longer be available or visible to the host operating system when the guest OS is running.
This means that if you enable access to your USB printer in VirtualBox, then the USB printer will no longer be available for use in your host OS. This is not as bad as it seems, when you shut down your VirtualBox session, the USB device will be returned to your OS.
Some images may be clicked for full sized versions.
Installing the VirtualBox Extension Pack
I don’t think it is absolutely necessary to install this, but if you don’t you will be using the slower USB 1 interface. Installing this extension pack (which is different from the Guest Additions) will enable USB 2 support.
1) Go to the VirtualBox Downloads page. It can be found here.
2) Click on the All Platforms link beside the VM VirtualBox Extensions Pack:
3) Click on Open if you get the following confirmation request in Windows 7:
4) Click on Install:
5) Read the license agreement (or, at the very least, scroll all the way to the end) and the click on I Agree if you accept the licensing terms (if you don’t agree, then you will not be able to install the extensions):
VirtualBox will then proceed to install the extensions pack. This will take a few minutes.
6) Observe that the installation was successful and click on OK:
Enabling a USB Device in VirtualBox
1) Plug in the USB device you want to share. Let it be detected and recognized by Windows.
2) Start VirtualBox.
3) Right-click on the virtual machine you wish to configure the USB device for, then select (left-click) Settings…. You could also left-click on the virtual machine and then press Ctrl+S
:
4) Click on USB in the left side panel:
5) Check the checkbox Enable USB 2.0 (EHCI) Controller:
6) Click on the tiny USB icon with the green plus sign (it is found on the right side of the dialog):
A menu containing the plugged in USB devices will appear:
NOTE: it is very likely your list of devices will be different from this one.
Alternately, you can press Alt + Ins
to bring up the list of USB devices attached to your computer.
Pressing Alt + Ins
means “while holding down the Alt
key, press the Ins
(or insert) key as if you were going to type it.”
NOTE: if you use the keyboard shortcut Alt + Ins
, the menu will appear where your mouse cursor is on the screen.
7) Click on the USB device you want (this might be tricky because the displayed name may not be obvious – for example, the Unknown device is a webcam):
This will add the device to the list of USB devices available to the virtual machine (again, your list will likely be different):
The first time you start the virtual machine with newly attached USB device, VirtualBox will: (1) disconnect the device from your machine and (2) create a VirtualBox USB device to connect to the device (for which Windows will automatically install the necessary device driver). When this is done, you should get the following notification:
NOTE: sometimes during this process, the VirtualBox machine will stop responding. It is safe (as far as I can tell because that is what I do) to kill the virtual machine and restart it.
When you log into your guest OS, the USB device will be attached to it.
NOTE: it may not be obvious or easy to find where the USB device is attached.
For memory cards and USB drives, I find it useful to start Disk Utility and examine where the disk has been mounted (for some reason I don’t find it in /mnt
):
In the image above you can see several attached drive locations. These are the slots in a card reader I had attached to the computer.
You can also see that the memory card in question was mounted as sdb
If you have attached a different USB device (printer, scanner, camera, etc), the guest OS (in this case Linux) may have limited or no support for the device.
I want to forward usb from linux host to windows guest. How can I forward devices that cannot be recognized by the guest OS, just grant hardware access?
It has been a few years since I have used VirtualBox (mostly because I have found the performance became quite unbearable for my tastes).
Nevertheless, I never ran Windows as a guest on a Linux machine.
My best guess is: as long as the Linux system can pick up the USB device (even if it can’t use it), you should be able to forward it to the Windows guest. When you do this, the USB device is no longer available to the host OS and is used by the guest OS.
As I mentioned at the start, it has been many years since I’ve used VirtualBox, so things may have changed (I don’t think so, but … I make no promises).