Oftentimes, that 512MB laptop SSD is just not enough. Sure it's fast, but a few downloaded games, movies, and photos later and suddenly it's full. So you buy an external drive - I have a decent 5TB WD My Passport external HDD that got me through college. And I'll admit, for 90% of users this is probably the cheapest, most practical option. External USB SSD enclosures have also come onto the market in recent years. Although I've never had one myself, I've heard good things about them from a few friends. They have much better speeds than and HDD, but fewer bytes per buck.

There's a few other downsides to external drives too: for one, you have to keep track of them. My dad was lamenting the other day that he has years of documents on a handful of hard drives and it's tricky to find that one tax form when you need it. Further, an unknown number of those drives might not even spin up. I've never personally had a drive fail on me, but I'm a hardware technician by trade and I replace a couple of failed drives a month. I was looking at drive failure rates while I was writing this and came across this website:
https://www.backblaze.com/cloud-storage/resources/hard-drive-test-data
that tracks and publishes drive failure rates - 1.89% annual failure rate - not high but still non-zero.

Finally, and this is where a network attached storage really shines: I want my drive available all the time, to all of my machines. I also don't care that much about speed - I'm mostly looking for stable, bulk, long-term storage. In summary, my objectives for this projects are to build a NAS with:

  • Lots and lots of space, at least a few terabytes
  • Always available to many devices (or at least the best I can manage)
  • Expandable with more drives, or large drives that get virtualized into one big storage chunk
  • A little bit of redundancy - if one drive goes clunk I don't want to loose too much
  • As cheap as possible - this isn't data center quality
  • Flexibility to format, divide, and make available the data as I please

On that last note - I want an always-online data server, but I'd also like some always-online services using the storage like a git repository or docker registry. I think that'd be hard to accomplish with a pre-built NAS or even a DIY NAS using an NAS OS like Open Media Vault or True NAS Scale - I might be completely wrong - please let me know in the comments - I didn't do much research into this as I was too interested in doing it the hard way.

Anyway, I've been rambling, let's get into the meat and potatoes of it:

The Hardware

I'm using a Raspberry Pi 4 for this. The primary motivation for this is that I was gifted one (thank you Cody!) and in a way, this entire project was motivated by trying to find a use for this Pi. But in retrospect, I don't think this is the best or cheapest option. For one, a Pi has zero SATA ports to begin with. I also ran into some cumbersome issues with firmware down the road using the Pi. I was able to resolve both of those eventually, but if I am ever to upgrade, I will probably just find a used PC that has a motherboard with a decent number of SATA ports and some PCI ports to add some SATA busses to. That being said, the upside of using the Pi is the low per consumption. I'm using a 60W power supply which pulls at most 525kWh/year or about $85/year in power. I've not done any measurements to get actual average power consumption, but it's definitely not running at peak power 100% of the time, so it has to be lower than that.

To plug four hard drives into the Pi, I'm using a Radxa Quad SATA hat that I got from Allnet China for $50 including shipping - I'm not thrilled with the price for what I got, but it's what I settled on. The 2GB Raspberry Pi 4 B, had I bought it, would be $45. next, I got four 4TB hard drives off of a local seller on Facebook Marketplace for $150. I think that's a deal for 16TB, though they'll have a lower life expectancy; the seller showed my the drive test results and I was able to confirm they were fully function after I bought them, but I would not accept the risk unless I was trying to do this cheap and knew I'd have some redundancy. I also grabbed an enclosure for the drives ($23), some SATA cables ($12), and a 12V 5A power supply ($12) off of Amazon.

I also bought a second, 12V 10A power supply ($17) when I was first getting the drives to work - I was having an issue with some of the drives going offline and coming back a moment later while I using all four of them under peak load for a long time while syncing them. I diagnosed this as being a power supply that could deliver 5 amps, but was failing momentarily when 5 amps was being pulled for 8 hours. I was wrong; it was a driver issue. Still, at least I have a spare power supply if this one fails eventually.

All in all, I spent $264 on this project; we'll call it $292 for fairness including the Pi and excluding the second power supply. Not bad considering a 4-bay off-the-shelf NAS is at least $600 at the time of writing.


Finally: here it is in all of it's janky beauty - I told you I was trying to make it cheap, right?

The finished network attached storage with many loose wires
The finished network attached storage

Next in this series will be the troubleshooting I did to get the drives online and raided, after that, the software configuration to make it available to my other devices.

Tune in then!

DIY Network Attached Storage - the Hardware (part 1)