Build a multi-drive NAS with Raspberry Pi 4 and several USB drives

; Date: Wed Dec 04 2019

Tags: Raspberry Pi »»»» Linux Single Board Computers »»»» Network Attached Storage

In the back of my mind is the question of replacing my Drobo NAS with something more modern. I've had it for about 10 years and surely it's time to replace it. An idea that bounced around recently is a Raspberry Pi 4 with a cluster of USB drives. For example 4 terabyte external portable drives are less than $100 apiece, and would be a small low power disk storage solution. The question is whether a Raspberry Pi is the best file server choice, and whether to leave the drives connected and spinning all day long.

The video attached below is a test of a similar idea. Using the Raspberry Pi 4, with portable USB drives configured in a Linux RAID configuration. The results weren't promising, and has me thinking of using my Intel NUC instead since it has several USB 3 ports.

Designing a Raspberry Pi NAS using external USB drives

The Raspberry Pi 4 is a big improvement over the RPI 3 on many fronts. For the purpose of this project the key win was that it has two USB 3 ports, and gigabit-ethernet, and that both of those run at full speed. That and the higher performance CPU means it'll give a lot higher performance than the Raspberry Pi 3.

The (www.amazon.com) Raspberry Pi 4 Model B 2019 Quad Core 64 Bit WiFi Bluetooth (4GB) is a good choice.

It's understood that the Raspberry Pi 4 CPU tends to heat up to the point where the CPU throttles its performance. According to tests I've seen the (www.amazon.com) FLIRC case for Raspberry Pi 4 is the best choice for keeping it cool. It does as good a job as most of the fan-based cooling solutions.

Connecting multiple drives to a Raspberry Pi 4 will require a powered USB hub. The Raspberry Pi 4 can export power through its USB port, but not enough to drive four USB drives. This product - (www.amazon.com) Powered USB Hub - ACASIS 10 Ports 60W USB 3.0 Data Hub - with Individual On/Off Switches - looks good. It seems most USB hubs don't have enough power to drive all their ports at full power. This one has the highest power capacity I could find.

For drives, a "laptop drive" (2.5" SATA drive) in an external case with USB 3 interface is a good choice. These are compact and low power and the (www.amazon.com) Seagate Backup Plus Portable 4TB External Hard Drive HDD is less than $100 apiece. Alternatively the WD 4TB Elements Desktop Hard Drive - USB 3.0 is a larger ("desktop") drive, with its own power supply, meaning you don't have to arrange enough power through a powered USB hub. Both of these are 4 TB drives for less than $100.

The Raspberry Pi can be powered from the USB hub as well, or you'll need to give it its own power brick.

Alternatives to the Raspberry Pi

While the RPI 4 has advantages as I mentioned earlier, it has a key critical flaw. It boots off an SD card, and of course SD cards are fragile and prone to croak. Hence your NAS, that you want to be ultra-reliable, will instead be brittle and prone to failure.

There are plenty of other Linux Single Board Computers on the market, some of which run off other mass storage choices. Or, one can boot the Raspberry Pi from a USB drive.

As the cost of this rises - some of the alternative Linux SBC's are pricey - you're getting into a price territory where it makes sense to use an Intel NUC instead. My NUC has several USB 3 ports which lowers the need for a USB hub, for example.

Results

Talk about the results - 4 drives seemed to produce contention on the USB bus

The drives used were 5400 RPM spinning drives in an external USB 3 case.

# Drives Write speed Read speed
1 drive 49 MB/s 95 MB/s
2 drives RAID 0 (striping) 57 MB/s 95 MB/s
2 drives RAID 1 (mirror) 57 MB/s 95 MB/s
4 drives RAID 1+0 35 MB/s 95 MB/s
4 drives RAID 10 35 MB/s 95 MB/s

The 95 MB/s number is pretty much the maximum you can get over gigabit ethernet.

The 4 drive setup was significantly slower. The presenter in the video believes this setup may have hit a maximum of throughput in the USB drivers in the Linux kernel. That's only a limitation to write speed, so if most of your usage is reading then you'll be fine.

In theory you're not limited to four drives because USB supports lots of devices. But there's the issue of data bandwidth limitations over the USB bus.

Which gets to my Intel NUC - an NUC 5i5RYH. It has four USB 3 ports. I don't know if these are on multiple USB controllers. Additionally this NUC supports two internal drives - e.g. one could have a 1TB SSD and a 4 TB spinning drive, for a reasonably large storage space, without worrying about external drives.

Build a Raspberry Pi NAS with 4 Hard Drives and RAID

About the Author(s)

(davidherron.com) David Herron : David Herron is a writer and software engineer focusing on the wise use of technology. He is especially interested in clean energy technologies like solar power, wind power, and electric cars. David worked for nearly 30 years in Silicon Valley on software ranging from electronic mail systems, to video streaming, to the Java programming language, and has published several books on Node.js programming and electric vehicles.