Oracle version of Virtualbox (The OSE version found in the standard repository does not support USB)
Virtualbox extension pack
Virtualbox guest tools
Member of the vboxusers group
Note: It is usually not necessary to add the USB device from the command line as described here. As long as the above prerequisites are met you can usually use the gui to add device filters.
I want to connect an external HDD to a virtualbox guest. The unit is a WD "My Book" and the guest is named "Windows". Make sure your VM is powered off before you start!
First, check that your user is a member of the vboxusers group:
groups | grep vboxusers myuser adm disk cdrom sudo dip plugdev lpadmin sambashare vboxusers libvirt
Note: If you aren't a member of the vboxusers group you must add yourself, logout and login again for the changes to take.
On the host running VirtualBox run the following command:
sudo VBoxManage list usbhost
Find the section that relates to the device you want to use. In my case it looks like this:
UUID: f61de8f1-9c92-4781-92c5-d091705a0b79 VendorId: 0x1058 (1058) ProductId: 0x1100 (1100) Revision: 1.117 (01117) Manufacturer: Western Digital Product: My Book SerialNumber: 57442D574341565930303934373837 Address: sysfs:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-4//device:/dev/bus/usb/001/003 Current State: Busy
Add a usb filter using the device details gleaned from the previous command:
VBoxManage usbfilter add 0 --target Windows --vendorid 1058 --productid 1100 --name "2TbExt" --active yes
The number after the "add" is the index number, if this is not the first device on the guest then adjust to the next "free" index. You can see the devices currently associated with a guest using this command:
VBoxManage showvminfo Windows
Finally enable usb for the guest:
VBoxManage modifyvm Windows --usb on
Now, after starting your VM, you should be able to see that the usb device is present in the virtual machine.
Note: If you have this working and it suddenly stops working, possibly after an update check that you still belong to the vboxusers group. If you don't belong to that group then no devices will show but there will be no "permisison denied" errors that might help to explain why.
UPDATED: November 2018