Friday, 4 June 2010

USB Devices in VirtualBox guests

I want to connect an external HDD to a vbox guest. The unit is a WD "My Book" and as in my previous posts the guest is named "io". Make sure your guest is powered off before you start!

On the host running VirtualBox (not the OSE version), run the following command;
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 io --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 io

Finally enable usb for the guest;
VBoxManage modifyvm io --usb on

Now, after starting your guest, you should be able to see that the usb device is present in the guest using the "lsusb" command in the guest;

brettg@io:~$ lsusb
Bus 001 Device 002: ID 1058:1100 Western Digital Technologies, Inc.

No comments: