Raspberry Pi NAS

Fair warning: this is not a HOWTO. I’m going to throw around terms like NAS, Samba, cron, UUID and rsync without explaining them. It’s my hope that somebody interested in replicating this will go out and figure out how to do it on their own. Learning how to use your Raspberry Pi is part of the fun!

There’s much to love about network-attached storage (NAS). What I don’t like is the lack of redundancy. True, if you have major bucks you can get a very nice QNAP system, but I wanted something simpler and cheaper—you know, something like a big terabyte drive with a twin for a backup because hard drives do crash. Oh, and I’m not trying to solve the issue of disaster recovery. It’s true: if a meteor hits the house, both hard drives will be destroyed.

So how about this? Two USB 3TB drives and a Raspberry Pi? The Raspberry Pi exports one of the drives via Samba so that Macs and Windows boxen are happy. Late at night, the Pi’s cron does an rsync from one drive to its backup.

The two drives are formatted as ext3. I’ve seen some folks talk about using NTFS, but I just can’t bring myself to do it on a Linux system. After creating the filesystems, I ran blkid to get the UUIDs necessary for /etc/fstab—otherwise how would one know which drive is which?

I’m currently in testing mode, but it works pretty darn well. For example, copying a 20GB tarfile (several years of .jpg pictures) from my MacBook Pro over Wi-Fi to the NAS took 118 minutes (2.8MB/s). The speed is not too dissimilar from using cloud storage.

I have sshd running on the Pi, so I don’t need a keyboard connected nor an HDMI monitor. Both drives have their own power supplies, so the two (underpowered) USB ports on the Pi are acceptable. After an hour or so of inactivity, the drives spin down and it’s just the little Pi using power at that point.

I’d also recommend assigning a static IP address to the Pi to make it easier to connect to. Raspian is the operating system of choice for this venture. You’ll only need to install the samba, samba-common-bin and rsync packages.