USB passthrough to a KVM guest instance:

Main server running: CentOS 7.7 x64 latest version. KVM guest machine running RHEL-7.4 (Maipo) but it can be any linux flavor.

USB flash drive attached to the main server USB port.

I tried all the guides that I could find on internet and even contacted RedHat regarding this. I was not able to expose the USB flash drive to the KVM guest instance.

In the end, in order to do that, the steps bellow are to be performed:

1. Connect via SSH to the compute node where the USB stick is attached:

2. Issue a lsscsi command (the output will be something like the one bellow):

In this case, the USB drive is: [24:0:0:0] disk SMI USB DISK 1100 /dev/sdc

3. Create a xml file to define some USB parameters that will be used to attach the USB device to the running vm (with the following content):

4. Check the ID of the running kvm guest:

5. Attach the USB device to the kvm guest instance

At the end you should see a message like: Device attached successfully

6. Now if you go to that kvm guest instance you should be able to see the USB drive and use it.

Share.

About Author

I am a linux passionate and currently working as a Linux Senior System Administrator. I also am a freelancer and help people to complete different jobs. You can hire me on Freelancer.com