When it comes to storage, there are those who prefer to roll their own, to try and improve on pre-packaged solutions, and maybe to learn something along the way. Manek freely admits to being among their number.
So this is the story of how he came to choose to build his own FreeNAS server to store his media collection and to act as a backup repository for his variety of home devices.
TESTED TECHNOLOGY HAS CONDUCTED a detailed examination of a number of NAS (network-attached storage) boxes over the years. The breed continues to improve and to gain performance and features but they all essentially consist of a small number of core elements.
And it’s this set of features that often provides the major differentiator between the various proprietary NAS products on the market. In other words, more features command a higher price.
Buy or build?
But what if you wanted to pick and choose the features? What if you decided you wanted all the best features available—such as file system that is as robust as they come—without having to pay a premium? What if you wanted to add functions to the box?
And what if you already have an old, superseded computer hanging around but can’t bear to chuck it away?
That’s the situation I found myself in—and why I decided to build my own NAS box. The computer in question lived and still lives in a large tower case with room for eight hard disks. Based around an Asus B85M-G motherboard and a 2.7GHz Intel Celeron G1820, it’s fairly low-powered, though a NAS box doesn’t usually need a lot of CPU power, and will accept up to 32GB of RAM.
So I didn’t see the sense of disposing of it for a range of reasons, including financial and environmental ones, and buying what would have been a new computer that replicated much of the functionality I already had at my disposal. And if I instead constructed a NAS to my own specifications, I would learn a whole lot more.
Choosing Your System
With the hardware platform pretty much sorted, the big question was: which operating system? There’s a host of NAS software suites out there, available for free. Some of them sit on top of pre-installed (usually) Linux, while others come integrated with the operating system.
But for me, the real choice was not so much between the various NAS software products, many of which would fit the bill, as between file systems. This is, if you will excuse the expression, where the rubber meets the road.
If the file system is not as robust as it gets, given the limitations of any underlying storage hardware, then you are increasing the risk of losing data. The data I’m storing consists of the usual mix of documents, images, videos and music, and I do not want to lose any of it. So for me, performance is less important than robustness.
File systems are very complex pieces of software and must be tested to destruction with a huge range of potential scenarios before they can be trusted with live data. Natural selection has winnowed out the failures, so, for me, three survivors were worthy of further exploration.
The three that I narrowed it down to were ext4, BTRFS and ZFS—all of which are widely available under free licences.
- ZFS adds scrubbing to all the features mentioned above, a process that checks that every bit written to the storage medium is the same as when it was first laid down. This avoids what’s called bit rot, data errors which can occur over time due to glitches in the magnetic medium, cosmic rays or other disruptions. ZFS is also used in large enterprises, where data loss can cost millions.
FreeNAS and ZFS
This narrowed down the choice of NAS software to FreeNAS, which integrates the NAS software, the operating system and the file system and made the choice easy; it sits atop FreeBSD, a version of Unix derived from BSD Unix, developed at the University of California. ZFS technology, now open-sourced as OpenZFS, was originally developed by Sun Microsystems, since acquired by Oracle, a supplier of databases and other products to banks and other large enterprises.
Installing FreeNAS was no more difficult than installing any other operating system, and from there it was a simple matter of switching on the required services—such as SMB (or Samba) for sharing with the Windows machines, NFS for sharing with other Linux machines, Rsync for client backup and AFP which at the time was needed for Apple shares. I then added shared directories for the various computers scattered around the house.
We now have an enterprise-grade operating and file system, all available for free, running on low-cost hardware.
But I’ve missed out a crucial element of the equation: storage. Let’s backtrack.
The “S” in NAS
At the time of building this FreeNAS server, my media collection occupied around 10TB, with backups from other devices adding around a terabyte.
I calculated I needed eight 3TB NAS drives in a RAID-Z2 configuration; a RAID-Z2 configuration uses two parity drives and allows for two drive failures before data loss occurs. Eight 3TB drives provide real-world storage under ZFS of about 15TB.
So I needed to connect the drives to the motherboard and, like most of its kind, the Asus board doesn’t provide enough ports for the number of drives I needed to use. So I chose an LSI Logic SAS disk controller, which through its SAS2008 chip offers enterprise-grade reliability and performance. It also provides eight SAS ports, which with the right cables can easily be connected to standard SATA-interfaced disk drives. This controller can be found second-hand for a reasonable price on a well-known auction website.
And that’s the system as it is today.
To conclude, the FreeNAS and ZFS combination has proved its worth and validated the original selection decision. Not only has the software been faultless, identifying very early on two drives that showed signs of failure and giving plenty of time to source and install replacements, it’s easy to use, offers all the functionality I need, and I can install other functions on the PC as required. And FreeNAS continues to be developed.
That’s it for now. I’m planning to pick up the rest of the story—especially about how to expand the system—in a later episode.