Allow USB ports to be passed through, not just devices


Oct 25, 2021
It seems that TrueNAS Scale only allows passing through usb devices (or if one has a PCIe usb card, the entire PCIe card).

In the data center this probably isn't a problem, as things aren't being detached/attached at random, and it works great for perpetually connected USB devices (say keyboard or mouse). However in the homelab environment, it works less well. Example: attaching/detaching usb disks.

What this meant for me, is every time I wanted to change what usb hard drive was visible in the VM, I had to reboot it (and perhaps even reset the shared device). I got around it, by passing through the entire PCIe card, and it worked great, except it made the PCIe card only usable by one VM.

But it seems, kvm/qemu allow more than just passing through a usb device, but one can pass through a usb port as well.

While I haven't tested this with TrueNAS Scale, if it would work as I would think (we know what they say about assumptions though), it would enable a user to "bifurcate" their USB ports between multiple VMs and have the connect/disconnect semantics that one would expect with USB.

To do a "complete" job of this, one would probably have to account for the USB resources to prevent multiple VMs from being configured to use the same port and trying to boot and stomping over each other on it (though its also possible that kvm/qemu already take care of that, and that the VM would refuse to boot then)