Ubuntu – How many usb hard drives can be plugged into a laptop using a port replicator


I've got a laptop with 2 USB 2.0 and 1 USB 3.0 ports and I would like to know how many USB hard drives I could plug into it. Is there a hard limit in the Linux kernel?

On the performance side, what is the speed shared across the drives plugged into the port?

Best Answer

  • Theoretically you can have up to 127 devices connected to one host PC but there are practical power and data bandwidth limitations that would prevent that. These 127 devices can be arranged in a tiered network of hubs up to seven levels, counting the PC host as level 1 and the farthest device as level 7. The PC supplies 5 units of power to a hub. Each unit is 100 mA and each port requires a minimum of 1 unit. The hub itself consumes one, leaving 4 units for up to 4 ports. So you will never find a bus-powered hub with more than four ports.

    Bus-powered hubs have a further limitation. Since each port has only a single unit of power, they can only connect downstream to a single device. You cannot connect them to another hub for expansion because that hub requires an additional 5 units. And not all devices can run off a single unit. A low-power device like a mouse will work, but a high power device can claim up to 5 units. High power USB devices will only work when plugged directly into a PC host or a self-powered hub that can supply 5 units to the port.

    When you connect a device, the PC queries the device for its capabilities and requirements. So, for example, the PC knows that it is connected to a 4-port bus-powered hub which means that each port can only drive one unit. If you try to plug a high power device into that hub, the OS will throw up an error message and refuse to enable the device.

    Bus-powered hubs are generally a bad idea because of these limitations and are intended mainly for mobile, not desktop use.

    On the other hand, if the devices that are plugged into the port are themselves self-powered, then they may not need more then one unit from the hub. For example external disk drives have their own power so should work okay on a bus-powered hub.

    A self-powered hub will be able to supply 5 units to each port, allowing high-power devices and further levels of hubs. So you could plug in one 7-port self-powered hub and then seven more 7-port hubs into that, giving you 49 available ports at just the fourth tier.

    Some self-powered hubs will allow you to use them also in bus-powered mode, but if you try to plug in too many devices, the OS will give you an error message.

    Most hub controller chips have 4 ports so you commonly see 4-port hubs. When they want to build a bigger hub, they just use two 4-port chips. But they have to daisy chain them with the first chip connected to the host and the second connected to one of the downstream ports on the first chip. This leaves only seven ports left for the user, three on the first chip and four on the second -- hence the common 7-port hub.

    USB is plug-and-play in the sense you don't have to know any of this stuff when you connect things up. The OS keeps track of the power budget of each hub and device, will tell you if the connection will not work, and that you need to use a self-powered port.

    edit: USB packets look like this:

    Packet ID: 8 bits
    Address: 7 bits
    Endpoint: 4 bits
    CRC: 5 bits
    Start of frame:
    Packet ID: 8 bits
    Frame Number: 11 bits
    CRC: 5 bits
    Data Packet:
    Packet ID: 8 bits
    Data: 0-1023 bytes
    CRC: 16 bits
    Packet ID: 8 bits

    Since the address is only 7 bits, you can only have 128 devices on the entire bus (with 7 bits that can each be on and off, there are only 128 total different combinations of bits possible). This includes your computer, so that leaves 127 other things you can attach to it.