I have an external drive attached to my server on which I store my backups. I've created now a virtual machine which acts as my backup server and to which all my systems backup to. For this I need to pass the external drive to the VM. This can be done with the following steps.

1. Find the ID of the USB device.

To list all IDs of the attached USB devices run the following command:

lsusb

This will output something similar to this:

Bus 004 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 003: ID 0a92:00d1 EGO SYStems, Inc.
Bus 005 Device 002: ID 1532:011a Razer USA, Ltd
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:2504 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The ID which we need to use in the next step is the string behind the ID part. XXXX:XXXX. Look for the one which belongs to your drive. The information after the ID should show you which device it is.

2. Attach the drive to the VM.

To attach the drive to the VM we execute this command, where 804 is the ID of the VM and the part after "host=" is the ID of the USB drive which we looked up in the previous step.

sudo qm set 804 -usb0 host=058f:6387

The drive is now attached to the VM and can be mounted with the usual steps.

Resources

Next Post Previous Post