I'm wondering what is the maximum number of USB devices the Linux kernel can manage? Does this depend on the root-Hub or something else, too?

Is there a way to increase this maximum number?

I need to do this, because I've ran into problems while trying to write to a large amount of USB sticks. To do this, I have a setup as follows:

There is 1 computer running Ubuntu Linux, with 3 (active) HUBs attached to 3 USB ports of this machine. All of those three HUBs are 7 port HUBs. To 6 of those 7 ports, more HUBs are attached. This gives me the number of 3 * 6 = 18 HUBs in the "second" layer. Each of these HUBs is an active 7 port HUB, too. There is a USB stick attached to every port of those second layer HUBs. In total I have 126 USB Sticks connected to the computer.

I have a script that searches for all USB disk devices (through listing /dev/disk/by-path/ ). Each of the USB disk devices is then first partitioned, written to using cp and then made bootable using syslinux. This is NOT done in parallel!

The problem: I only get 105 USB disk devices using

ls -la /dev/disk/by-path | grep usb | grep -v part | wc -l

The LEDs of the sticks in 3 rows (one row corresponds to one HUB in the second layer) are off, too.

How do I get all of those sticks to work? (Or possibly even more?)

link|improve this question
6  
Are the hubs powered (as in, with their own power adapters, not just through the USB connection)? If not, you're probably just running out of power over your USB connection. – music2myear Dec 23 '11 at 17:49
Yes, all of the HUBs are powered. – Daniel Oertwig Dec 23 '11 at 18:33
Have you moved the hub which is not powering the sticks? It may be defective. Try it directly in a port on the box. – CharlieRB Dec 23 '11 at 18:56
Does the missing number of devices in /dev/disk correspond exactly to the unlit sticks? – Paul Dec 23 '11 at 21:49
@Paul: Yes, the number of missing sticks (21) does exactly correspond to the number of unlit sticks. – Daniel Oertwig Dec 23 '11 at 23:50
show 2 more comments
feedback

1 Answer

It's by standard as explained here: https://en.wikipedia.org/wiki/USB_device#System_design

You can't have more than 127 devices (hub inclusive) connected to a single host controller.

Now: the host controller+3 hub (1st layer)+18 hub (2nd layer) = 22 devices that DON'T appear as disk devices.

127 minus these 22 USB devices = 105 devices that can be managed by the kernel as disks.

127 devices is a hard limit of the USB protocol (see here: http://www.beyondlogic.org/usbnutshell/usb3.shtml#USBProtocols) because the ADDR address field is seven bit long.

So by software there is no way to increase it. Maybe you can try with more than a host controller interface, or change topology by reducing the number of hubs (thus increasing the number of disks seen by the system).

link|improve this answer
Perhaps you can temporary disable some devices, allowing other to be plugged in, meaning that you can work with 105 disks at a time. But I don't know how to unplug and replug usb devices via software. – David Costa Jan 16 at 13:03
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.