Lessons from a year in the trenches with BSD’s killer app.
I will confess that the TCP/IP stack is truly BSD’s killer app, giving us the Internet as we know it but that’s pretty old news and it’s no longer the de facto standard. Other contenders for this status are OpenBSD’s OpenSSH and Packet Filter thanks to their reach and occasionally FreeBSD for setting Internet traffic records. Today however I will argue that the single most valuable piece of BSD software to the greatest number of users is FreeNAS, the open source Network Attached Storage distribution maintained by FreeBSD-oriented hardware vendor iXsystems.
Why? For the simple reason that FreeNAS proves itself equally useful to users of Windows, Mac OS X, free and proprietary Unix, VMWare, XenServer, dlna appliances and just about anyone else who has something to store. We have developed an insatiable need for digital storage and most people probably don’t realize how fragile their storage infrastructure is until it’s too late. FreeNAS stands out from other Open Source storage appliances by bringing enterprise-class features to within the reach of just about everyone with the key feature being the ZFS “Zetabyte File System” developed by Sun Microsystems. ZFS delivers a level of data integrity protection that had previously only been available in high-end proprietary solutions. While ZFS is not perfect, it is the best all-around Open Source file system available today and of course is never a substitute for a rigorous backup strategy.
Sparing you the details, ZFS performs ongoing data integrity checks that other filesystems do not and it includes institutionalized rollback and replication. By virtue of having a “clean slate” design, ZFS does require some time to wrap your head around but FreeNAS users do not need to learn its syntax unless they choose to. This is a clue to why FreeNAS is a killer app: you can set it up in minutes but it gives you countless layers to explore down to its underlying FreeBSD/NanoBSD operating system and Django-based web interface. FreeNAS does not yet lend itself to customization but an experienced system administrator can migrate a FreeNAS configuration to a dedicated FreeBSD server without too much trouble. The HUGE advantage of FreeNAS’s FreeBSD underpinnings however is the fact that diagnosing a FreeNAS system is largely a matter of diagnosing FreeBSD. With both FreeNAS and FreeBSD getting better with every release and the introduction of the FreeNAS plugins architecture, we a dealing with not just an appliance but a platform with a growing ecosystem.
Like just about any BSD, FreeNAS will boot on just about any hardware but you would be wise to do some careful planning in advance and be willing to invest a little money. The first two golden rules of FreeNAS should be obvious: invest in the best hard drives and storage controller your budget will allow. The third rule is to invest in at least 1GB of RAM, preferably ECC, per TB of desired storage. While only time will tell which specific hard drives are truly the most reliable, you should avoid the lowest-end consumer drives. Do your homework on the best drives currently available and note that some drive makers are now offering mid-range drives tuned for NAS use.
Not to make an endorsement, FreeNAS and FreeBSD have long had very good support for LSI controller cards and note that you want “Target” or “JBOD” mode when using ZFS, allowing ZFS to handle all redundancy features. FreeNAS is not a ZFS-only solution and will in fact allow you to create UFS arrays and even share a hardware RAID array. Each approach has certain advantages but ZFS’s portability is a very nice feature. It is by no means universally portable but ZFS is one of the most cross-platform portable file systems available. As for affordable motherboards that support ECC memory, they do exist and you need only do your homework.
The Weakest Link
Once you have FreeNAS-ready hardware, there is one thing you should know about ZFS to avoid shooting yourself in the foot: Your ZFS pool is only as strong as its weakest link. A “pool” is a ZFS storage array and is fundamentally a RAID 0-style “stripe” comprised of one or more “vdevs” or virtual devices. The most common type of vdev is ZFS’s “raidzN” which as its name implies, is like a traditional RAID array with “N” number of failable disks. That is, a raidz1 array can suffer the loss of one member disk and two for raidz2. While raidz is considered the de facto strategy for ZFS pools, the cumulative nature of the vdev model also means that creating RAID 1+0 striped arrays of mirrors is pretty straight forward. To create a RAID 1+0 ZFS array in FreeNAS, simply configure a mirror of two or more drives and add additional mirrors to it. This will have the performance advantage of no relying on calculated parity for redundancy. Herein however lies one of the greatest weaknesses of ZFS: it will allow you to add any device, including a USB key as a member vdev and removing it will compromise your entire pool. For this reason you should not think of ZFS as a safe way to cobble all of the hard drives you have lying around.
With these rules in mind, FreeNAS is remarkably forgiving and quick to set up. A Windows CIFS share can be set up in seconds by creating a Volume using the Storage: Volume Manager followed by Sharing: CIFS Shares: Add CIFS Share. Simply enable “Browsable to Network Clients” and “Allow Guest Access” and the resulting share should be visible by Windows, Mac OS X and BSD/Linux clients. You would be wise to take steps to limit access to the resulting system but this starting point will meet the needs of most SOHO users. From there the documentation is pretty straight forward about setting up more sophisticated shares such as iSCSI targets and NFS shares for use by server operating systems like XenServer, VMware and Microsoft Windows Server. Add in replication and you have an open source storage solution that was unimaginable just a few years ago.
The FreeNAS Platform
It’s no secret that some users were upset when the recent rearchitecture of FreeNAS temporarily removed some home user-oriented features but the remedy is inadvertently taking FreeNAS to a new level. While the developers could have simple replaced the missing features, they opted to build a plugins architecture that is rapidly gaining PC-BSD features such as the PBI package management system and Warden jail management system. These two features will create countless opportunities for FreeNAS as a platform for print, monitoring or database serving in addition to the much-requested multimedia serving. I can’t think of a single Linux distribution or competing NAS solution that begins to embrace this platform-centric approach.
With all this going on, the question of “Which FreeNAS?” is turning from one of which demographic will use it to identifying one of many FreeNAS systems in a given environment. There is simply much more to FreeNAS than ZFS and I have even heard of people putting it in front of proprietary NAS systems to gain missing file sharing protocols. Add in a rich set of third party software daemons through the plugins architecture and the result is an unprecedented serving platform that is useful to every category of user.
Michael Dexter has used BSD Unix systems since 1991 and wrote his first FreeBSD jail management system in 2005. He has sponsored the BSD.lv sysjail and mult multiplicity research projects and took his BSD support public with the formation of BSD Fund in 2007. Michael is now the CTO of the BSD vendor Gainframe and Editor of the BSD technical journal Call For Testing.