How many external HDDs can you have in a Raspberry Pi 4 8gb?

@kreaninw Check for the following line with dmesg | grep xHCI

Max number of devices this xHCI host supports is 32

There is a hacky way to extend this limit by using the USB-C port but you need to use an alternative power source for the Pi and it is not detected at start-up which sucks:

1 Like

I checked my lsusb -t, it seems my 7-ports hub is using 2 chips chained together as VL817 supports the maximum of 4-port configurations (like most, if not all USB controller chips) so port 4th is chained to another chip coresponding to port 4-7, it’s 3+4 configuration making 7 ports in total.

However, there is a caveat here. If you plug in the hub to any of the USB 3 port, a single hub will show itself as 2 devices (2 chips chained as explained above), but if you plug in the hub to any of the USB 2 port, a sigle hub will need to register itself as 4 devices first, then another 2 devices for the actual ports, as shown in my lsusb -t below:

/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        |__ Port 1: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
        |__ Port 2: Dev 6, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
        |__ Port 3: Dev 8, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
        |__ Port 4: Dev 10, If 0, Class=Hub, Driver=hub/4p, 5000M
            |__ Port 3: Dev 15, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
            |__ Port 1: Dev 12, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
            |__ Port 4: Dev 17, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
            |__ Port 2: Dev 13, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
    |__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/4p, 5000M
        |__ Port 3: Dev 9, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
        |__ Port 1: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
        |__ Port 4: Dev 11, If 0, Class=Hub, Driver=hub/4p, 5000M
            |__ Port 3: Dev 18, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
            |__ Port 1: Dev 14, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
            |__ Port 4: Dev 19, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
            |__ Port 2: Dev 16, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
        |__ Port 2: Dev 7, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 15, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 4: Dev 16, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 2: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 4: Dev 7, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 3: Dev 5, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 1: Dev 8, If 0, Class=Mass Storage, Driver=usb-storage, 480M
            |__ Port 2: Dev 9, If 0, Class=Mass Storage, Driver=usb-storage, 480M
            |__ Port 3: Dev 10, If 0, Class=Mass Storage, Driver=usb-storage, 480M
            |__ Port 4: Dev 11, If 0, Class=Hub, Driver=hub/4p, 480M
                |__ Port 4: Dev 14, If 0, Class=Mass Storage, Driver=usb-storage, 480M
                |__ Port 3: Dev 13, If 0, Class=Mass Storage, Driver=usb-storage, 480M
                |__ Port 1: Dev 12, If 0, Class=Mass Storage, Driver=usb-storage, 480M
  • 5000M is USB 3, 480M is USB 2.

By knowing the above info and my Pi limitation, theotically I should get a maximum of 20 drives connection: (20+(2*2)+(1*6) = 30 connections.

  • After restarting my Pi, I don’t know why I can’t replicate 21 drives connection anymore. I can only do 20 drives 100% of the time while the 21st drive only show as HDD in GNOME Disk without any option to be mounted.

Therefore I think 20 drives connection is the practical limit for the Pi.

However, there’s still more interesting fact here. The xHCI host in Pi 4 actually support 34 devices maxed not 32, as my lsusb | wc -l returns 34. My dmesg | grep xHCI returns 4 devices as the xHCI Host Controller:

[    2.641083] xhci_hcd 0000:01:00.0: xHCI Host Controller
[    2.642213] usb usb1: Product: xHCI Host Controller
[    2.643502] xhci_hcd 0000:01:00.0: xHCI Host Controller
[    2.643780] usb usb2: Product: xHCI Host Controller

Nevertheless, it’s still endup 30 actual available slots for your device. And no matter hub you choose, as most of the chips (if not all) only support 4 downsteams/ports configuaration per chip, you will most likely limited with 20 usable USB ports :sweat_smile:

Such a long journey for me as a Pi farmer :sweat_smile:

3 Likes

Excellent investigations there!

The behavior of the USB 2.0 ports is interesting, I didn’t expect that it would “eat” 4 devices for itself.

Here’s an idea. You can chain the 7-port hubs together and plug each set into a USB 3.0 port, ignoring the USB 2.0 ports. You can chain hubs together if you keep the total number of chips (hubs) in a chain below the tier limit of 7 (so 6 chips) (see How Many USB Devices Can I Connect? | Acroname). Here are two examples with 2 hubs chained together (4 chips) and 3 hubs (6 chips):

Chain 1
Hub > Hub > Pi USB 3.0 port #1
(6 + 7 ports) + (2 + 2 chips) = 17

Chain 2
Hub > Pi USB 3.0 port #2
(7 ports) + (2 chips) = 9

Total = 26 devices (20 drives)

Or

Chain 1
Hub > Hub > Hub > Pi USB 3.0 port #1
(6 + 6 + 7 ports) + (2 + 2 + 2 chips) = 25 devices (19 drives)

Now, you should have some “slots” available so you can attach drives (or even a 4-port hub; 5 devices) to the unused USB ports. This could potentially get you to 21+ drives (depending on the “multplying” behavior of those USB 2.0 ports) :grinning:

1 Like

I think it would be a benefit for anyone to know why I decided to buy another Pi 4 to connect to the rest of my HDDs.

At first, I was considering ROCK Pi 4 B or C due to its more powerful CPU. But I decided to go with Raspberry Pi 4 B because of these reasons:

  1. ROCK Pi 4 only has 4GB of RAM maxed, thus needed swapfile to operate diminishing its faster CPU (around 20% faster) advantage over Raspberry Pi 4.
  2. AFAIK, ROCK Pi 4 has a very slow microSD card reader, around 20 Mbps, the same as the pre-Pi 4 eras. While Raspberry Pi 4, which improved this over its predecessors, has double the speed at around 40 Mbps ++. Therefore ROCK Pi 4 doesn’t give me the economical advantage from using Pi as I will have to either buy their eMMC or SSD which is a lot more expensive than a microSD card. Otherwise, I would be stuck with a slow-ist system.
  3. There’s no official support for Ubuntu desktop for ROCK Pi 4 as their official supported OSes are Android, Ubuntu server, and Debian desktop. Raspberry Pi 4 has a better out-of-the-box experience.
  4. The community size, available gadgets, tutorials, and etc seem to better on the Raspberry Pi 4 side.

What I choose for another Raspberry Pi 4:

  1. Instead of the official case and fan case, which I found to be not sufficient enough, I go for the Ice Tower as a cooling solution.
  2. I buy Sandisk Max Endurance 32 GB this time around. Because anything above 40 Mbps seems to be pointless to use with the Pi. Therefore I would rather choose a card that can operate 24/7 for many years to come instead of a super-fast card.

Why I didn’t go to PC:

  1. I believe that even a PC board would have the same limitation. It won’t connect to 100-ist USB devices, that for sure.
  2. The cost of building one working board wouldn’t justify compared to the Pi. And also the electricity cost that it will consume. My goal is to farm at the minimum cost so I stay in the game for so long until the day Chia goes to the moon :sweat_smile:
2 Likes

I have tried to chain my USB 3.0 port like that. However, things only go smooth as far as I chain no more than 1 hub per original port. And when I chained 2 hubs in USB 3.0 port #1, port #2 would be unusable. It seems there’s a 1 port per 1 hub rule here.

Therefore I end up connecting one hub per port as I wouldn’t lose a port in the first hub to chain another hub :sweat_smile:

1 Like

Oh I see. That’s a shame, but good information to know, thanks!

1 Like

I believe that a powered hub is not a good idea as it can back-feed its power to the Pi making it unable to boot/reboot. It’s also a lot more expensive than the non-powered hub.

upd1: I am using Sandisk Extreme Pro 32 GB. But I am moving to Sandisk Max Endurance 32 GB for another Pi as it can withstand 24/7 operation for as long a decade. I don’t need Extreme Pro 100 Mbps write speed as the Pi can only go as far as 40 Mbps.

upd2: I am now farming with CLI as the CPU stays almost the same as when my Pi is on idle. My recommendation is that you set everything in GUI. And when that’s done, just farm on CLI. You can farm on many chains easily. The Pi’s CPU is not a limitation when it comes to farming.

upd3: Even when the Pi’s CPU is at 90% or above workload, I have never experienced the plots response time of more than 5 secs. It takes 4 secs at most for me.

1 Like

Why not a 120 euros mini PC?

  • Bmax b1 mini pc can be bought for less than 110 euros in Aliexpress

You get a Windows PC that you can use after the Chia project if it does not go well :wink:

I don’t think it’s a good idea to have Bmax B1 running Chia operation for the following reasons:

  1. It has Intel N3060 CPU which is even slower than the BCM2711 found in the Pi 4. It also has a much slower RAM speed, DDR3-1600 vs DDR4-2400, due to CPU’s limitation.
  2. It only has 4GB RAM compared to 8GB available in the Pi 4. Therefore you will need to use swapfile(pagefile) in Windows 10 even more than you would in Ubuntu contrary to the Pi which can run on RAM 100% without needing to rely on swap.
  3. Pi 4 B 8GB + Ice Towwer + microSD ME 32GB + power adapter is still 10 euros cheper than Bmax B1.

Considering the above reasons combining with Windows 10 apps that you would be able to run on Bmax B1, I don’t think you would lose anything with the Pi :sweat_smile:

2 Likes

That’s some very nice discoveries you guys made in the last week! So it looks like the limit for a Raspberry Pi 4 8gb is of 20 HDs (maybe more as @Harris pointed in his post above, with the trick to use the USB-C, but it may not be worth the complication). Due to its low energy consumption it looks like it may be the best alternative so far.

I wonder now what’s the maximum USB ports that can be used in a regular computer. Looks like nobody could achieve 100 USBs in a single motherboard yet, but there’s a guy that told me he could store 56 HDs in a BTC-37 with 8 PCIe to USB3 adapters. I’ll make this test later this week and post it in another topic to leave here just for the Raspberry Pi 4.

Very happy to see you achieved the maximum capacity of the Raspberry Pi 4 @kreaninw!

2 Likes

I would like to know how you got more than 8 drives running on a Pi4B 8GB?

I have built a 14-drive array, with USB hubs. Each drive has a SATA-USB powered converter, and each of those converters plugs into a USB hub.

First, I tried 2 of these hubs:
https://www.amazon.com.au/dp/B087J5PCGK?ref_=pe_2361882_297267902_302_E_DDE_dt_1

They can be powered, or not powered (via a micro-usb plug). First I tried not powered. It seemed I could get 7 drives working with any combination. That is, 3 on 1 hub, 4 on the other; or 7 on 1 hub (etc). As soon as i plugged in the 8th, the USB would crash–mouse & keyboard stopped working, and the Pi would need a reboot.

I then tried the same with the hubs, powered. Same problem.

I saw someone online was using the Sabrent 16-port powered hub. I decided to bite the bullet and spend the cash. It arrived today, and it pretty much has the SAME problem again! I managed to get 8 drives connected, but as soon as I add the 9th, weird things happen (drives drop out, mouse/keyboard stop working).

I can run multiple Pis, but I see that you have been able to get more than 7 or 8 running. I would like to get all 14 drives on 1 Pi if possible.

What OS are you running? I’m currently running Ubuntu 21.04 Desktop.

Help appreciated!! :smiley:

/Raymond

Just for fun, I installed Manjaro. I managed to get the Pi to see 10 drives, but failed when I plugged in the 11th.

I’ve also tried all this on a non pi (a ThinkCentre running Ubuntu). On that, I could only get 7 or 8 drives. Any more, and it failed with the same problems I was seeing on the Pi.

And, I plugged all 14 drives into my 16 port hub on my Mac, and the Mac saw them all no problems.

I really don’t know what to do next.

Huh. That is interesting… Honestly i have no idea what the problem is, maybe its some problem with the usb to sata and compatibility issues. Its a mystery…

Maybe install linux on your mac and see if the problem comes back. Hahaha. Im joking.:laughing: Sort of. :neutral_face:

I have Windows server 2019 on my server with the USB drives on it. Currently I have 4 USB drives on it split on my 2x rear USB 3.0 ports. I also have my wireless Logitech backlit keyboard/trackpad combo on one of 2 USB 2.0 ports. Overall, I can’t complain other than the more HDDs writing to the USB 3.0 controller, the slower the overall performance per drive gets.

You can start by knowing the specifications of your hub’s controller chip as well as the host controller in your Pi/PC.

I don’t know. But the Pi should support 30 devices connecting through USB. When connecting to 3 hubs, I can connect to 20 HDDs drives in total (10 device slots are used by the hubs).

Currently, I am replacing the old plots with the new poolable plots. I have zero issues with 20 drives that I swap around. The connection is solid. My average response time according to Chiadog is only 1 sec.

Try to list the connected devices by lsusb and lsusb -t. I am suspecting that your hub could use a lot more slots than mine.

1 Like

What OS and version are you using?

What hub type are you using?

I am using Ubuntu 21.04.

I am using this hub (7 ports).

All the info that you ask for is already available in detail in this thread. Please read back to what we had been discussed. I believe you will get more info that way :+1:

Sorry, I did try to find OS versions in the thread, but couldn’t. Also just searched again, and only mine and this repy has the version number. Ah–my mistake. The “magic page load” wasn’t showing the whole thread. Note to self, don’t use browser “find in page”! :smiley:

I’ve done an lsusb, but it only shows 20 ports in use.

Grr. The hunt continues. Thanks for your help.

/Raymond

1 Like

I am also a PI farmer, this post is very informative/educational for me, many thank to all for sharing, especially to @kreaninw

I am currently running smoothly with 7 USB HDD (harvester proof seek time < 1s, average @ ~0.2s), my configuration:

  • PI4 4G Model B (dmesg shows: Machine model: Raspberry Pi 4 Model B Rev 1.4)

  • OS: Ubuntu Desktop 21.04

  • USB HUB: Orico 16 port hub 2.0: ORICO 16 Port USB2.0 Hub, it has 4 controller chips and occupies 5 usb devices in my PI (lsusb shows 5 entries belonging to this hub)

  • 7 HDD x 6TB with 385 plots (mixed OG and PP)

  • lsusb and lsusb –t show there are 17 entries (5 entries belonging to the hub)

But when I added my 8th USB HDD, firstly it worked normally (can mount partition and farm), but after short time it automatically unmount, my initial troubleshoot showed:

  • Using lsusb and lsusb –t, I can see my 8th USB HDD, and there are total 18 usb entries. But lsblk –f does not show its HDD/partition

  • lsblk –f does show 7 HDD with Device name from sda1 to sdh1 (/dev/sda1; /dev/sdb1; /dev/sdd1; /dev/sde1; /dev/sdf1; /dev/sdg1; /dev/sdh1). The device name /dev/sdc1 is missing (I mount them automatically by using UUID in /etc/fstab)

Appreciate your advice what to do next.

2 Likes

According to this article from Chia team in Github: Reference Farming Hardware · Chia-Network/chia-blockchain Wiki · GitHub

“Here a build from early community user that houses 32 drives farming off a RockPi4 and Sabrent USB hubs for an average power consumption of ~250W & ~5.6kWh per day (last 30 days) - easily making it one of the most power-efficient farms built so far!”

It seems someone already successfully tested PI4 with 32 USB HDD. Do we miss anything here?

1 Like