Adding multiple identical USB devices to different LXD instances

Hi all

I read the following guide on how to add USB devices to an LXD container. Sounds so remarkably easy!

However, I would like to add multiple identical USB devices to a Linux host and have each device be connected to its own LXD container :slight_smile:

How would I go about doing that?

When you connect a USB device to the host, udev runs and configures the device. Depending on how different or similar the devices are, you can add here some sort of differentiation. One way to differentiate USB devices that have the same Vendor and Product IDs, is the USB port that you have connected them through. See, for example, at https://www.linuxquestions.org/questions/linux-general-1/udev-rules-to-differentiate-between-multiple-identical-devices-822879/ or 14.04 - Use udev to rename devices with same properties - Ask Ubuntu on how to differentiate those otherwise identical devices. You would change their Vendor or Product IDs to values that you have configured into the LXD configuration.

LXD can differentiate USB devices according to the Vendor and Product IDs, https://github.com/lxc/lxd/blob/master/doc/containers.md#type-usb

1 Like

Thanks very much for those links :slight_smile:

I have read the information in the links and would like to know how I can "change their Vendor or Product IDs to values that you have configured into the LXD configuration.

I know udev allows to create symlinks for devices to differentiate them. But I need to change the pid/vid so that I can add the different devices to different containers.