Unraid USB Controller Passthrough – VM hot swap USB

Unraid USB Controller Passthrough - Fresco FL1100

For the longest time, I have been running VMs on my Unraid server and had the need to passthrough USB devices. I will be the first to admit that I have too many computers and a shrink might classify it as an addition. Coupled with my quest for a clutter-free desk, I have been faced with the issue of swapping USB devices like a keyboard and mouse, from one machine to another Unraid virtual machine (vm).

Solving the physical component of changing the device from one machine to another is easy. Just acquire a USB switcher/KVM such as this:

A simple USB switch / KVM

There are hundreds of these and they are relatively cheap. However, the real problem is that when you switch the keyboard and mouse into the Unraid server (in an attempt to ‘plug’ them into a VM), they are assigned to the Unraid host, not a VM.

In the past I have developed a way to use a Pi with a button attached to send virsh commands to Unraid, connecting the USB device to a particular VM. This worked well, but required me to push 2 buttons; one to physically switch the USB devices, followed by another to run the virsh command from a Pi – only mildly irritating. The main irritation was the limit to the number of times you could ‘attach’ a USB device to a VM before its virtual hub became full. So I tried removing the device before attaching it (all using virsh) and ultimately ran out of skill and/or patients.

What I really needed was a USB controller to be permanently pass through to the VM. Then, whenever a device was plugged into that USB controller, it would be connecting to the VM and never the Unraid host. And so then next issue (which we are about to solve), which USB controller and how to pass it through?

Inateck Superspeed 4 Ports PCI-E to USB 3.0

I found the ‘Inateck Superspeed 4 Ports PCI-E to USB 3.0’ on Amazon and took a bit of an educated guess on whether I would be able to pass it through. The supported card/controllers list is very thin on the ground.

Importantly, it used the Fresco FL1100 series chipset, which to the best of my reading, can be passed through to a VM. It is also popular with crypto mining for this reason.

How to pass through the USB controller

Prerequisites:

  • A working VM
  • CPU and Bios that supports VT-d (and has it enabled)
  • USB pcie card

Find the device identifier

With the USB card plugged in, we must first identify it. Sadly, I cannot confirm that this card will show up in its own IOMMU group as it did for me, so your mileage may vary. My card shows up in its own IOMMU group and I can see its ID: 1b73:1100.

Unraid USB Controller Passthrough - finding the FL100 USB chipset
Fresco FL1100 USB Controller

Edt Boot config

Now we need to tell Unraid to ignore/backlist the device by its ID, so that it will be available for passthrough. Go to the Main page, and click on your flash device to start editing the Syslinux boot config:

Unraid USB Controller Passthrough - UNRAID system config
Unraid USB Controller Passthrough - UNRIAD system config editor

Under ‘kernel /bzimage‘ paste the following line, replacing the ID with yours appropriately:

  append initrd=/bzroot pci-stub.ids=1b73:1100

Save this, then it is time to reboot.

Edit the VM

Now we can edit the VM (with it powered off) and add the pcie USB card:

Unraid USB Controller Passthrough - unriad VM options

SUCCESS!

You should now have true USB hot swap in your UNRAID VM. I have had this working reliably for a number of weeks at this point, the passthrough config survives a complete system reboot and UNRAID upgrades.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: