An introduction to FreeNAS
Open Space
In 2005, after an inordinate struggle to set up his own home networked file storage, Olivier Cochard-Labbé decided to create a solution to streamline the process. Much coding and configuring ensued, and he spawned FreeNAS – Free, as in freely available (open source) and based on FreeBSD, and NAS, as in Network Attached Storage.
Before long, a vibrant community formed around the project, and FreeNAS [1] began to take shape as an actual product. It came to include a range of services, from file sharing to media streaming.
By 2010, however, Cochard-Labbé was no longer able to commit sufficient time and resources to keep the FreeNAS project going, so he transferred control of it to iXsystems [2], a company well-known for its support of open source software in general and FreeBSD [3] in particular. A period of considerable development effort followed, which involved updating and modernizing the software and improving the project infrastructure to meet the needs of a growing FreeNAS development community.
The user interface was completely reimplemented, and features like disk encryption for ZFS pools and a third-party plugin system to support the installation of non-core services were added. Today, FreeNAS is under very active development, with hundreds of thousands of downloads for each release – more than 5.5 million in total since its inception.
Although FreeNAS was designed for home and small office environments, it does have a true business-class counterpart: TrueNAS [4]. Based on FreeNAS, TrueNAS is an enterprise-grade unified storage appliance also created by iXsystems, designed with the mission-critical IT environment in mind. TrueNAS adds enterprise features like hardware failover, performance tuning, reporting, 24/7 support, and other high-reliability enhancements that are made possible by having complete control of both software and hardware. However, a surprising number of maverick sys admins do use FreeNAS in business and enterprise environments, because it can be quite effective when employed with the necessary skill and care.
In this article, we introduce FreeNAS and provide an overview of those features most relevant to enterprise users. We also discuss ZFS, which is the primary filesystem used in FreeNAS and a significant source of its power. We will point out hardware or configuration considerations necessary to get the most from FreeNAS and, finally, describe how to set up and maintain a FreeNAS installation.
Storage Made Simple
A key feature of FreeNAS is ZFS (or "Zettabyte" File System). Originally developed by Sun Microsystems, ZFS [5] was designed for large storage capacity and to address many storage issues, such as silent data corruption, volume management, and the RAID 5 "write hole." FreeNAS 9.1.1, the most current release at the time of writing, uses all of the most advanced features ZFS has to offer.
The copy-on-write technology of ZFS makes possible many of its most impressive features. Because block pointers are not updated until the data is written to disk, the typical RAID write hole problem does not apply to ZFS. ZFS also supports a snapshot feature, which works by preventing the deletion of blocks that are part of files present at the time a snapshot is taken. As long as these blocks don't change afterward, preserving the snapshot uses virtually no space. ZFS deduplication works in a similar fashion, maintaining tables of which blocks are used in which files.
ZFS supports a variety of software RAID levels, including stripes, mirrors, and up to triple-parity RAID-Z. The FreeNAS ZFS Volume Manager (Figure 1) guides the user toward a configuration that is optimized for the number of disks available.
The FreeNAS graphical interface also supports the configuration of arbitrarily nested ZFS datasets within filesystems. ZFS datasets are like subdirectories that have configurable properties independent of their parent filesystem, such as the ability to configure compression or deduplication on a per-dataset basis. ZFS datasets can also be configured with quotas and reserved space, making them useful for thin-provisioning scenarios. Snapshots of datasets can be scheduled separately from the parent filesystem, or they can be included recursively in a snapshot of the parent volume.
As of version 8.3.1, FreeNAS also supports the creation of ZFS volumes on encrypted disks. This block-level disk encryption framework is based on Geli from FreeBSD and supports hardware acceleration on systems with AES-NI-capable processors.
Core Services Configuration
FreeNAS provides built-in support for a variety of network file-based protocols, including CIFS and NFS. CIFS (Common Internet File System) is commonly used in Windows environments or those with a mixture of Windows and Unix-like operating systems. NFS (Network File System) is commonly used for high-performance applications and in heterogeneous environments. FreeNAS also supports AFP for Mac OS X environments, including Time Machine backups. Each service can be configured from its corresponding wrench icon (Figure 2).
The data to be shared is configured through the Sharing section of the web UI. ZFS datasets allow for complex sharing scenarios, enabling the administrator to tailor a configuration to meet the network's needs, such as user/group quotas, user/group permissions, data properties, and customized snapshot and backup requirements.
For block-based applications, FreeNAS supports iSCSI target mode for file extents, physical disks, or zvols, a ZFS feature that creates a virtual disk device for which the blocks are stored in the parent filesystem. Regardless of which filesystem the target is formatted, shared block devices will adhere to the snapshot and backup policies on the storage side, with no interaction required from clients. CHAP and mutual CHAP are included for target and initiator authentication.
Built-in directory services support for Active Directory, LDAP, and NIS allows large organizations to integrate FreeNAS into their existing infrastructure. Other built-in services include UPS support, SNMP, and SSH as remote management alternatives, as well as rsync for more specialized replication and backup scenarios.
Save the Data: FreeNAS Backups
FreeNAS supports a wide variety of backup methods. As just mentioned, the rsync service provides built-in incremental backup capability. iSCSI extents can be used with native backup software on applicable platforms. A Mac OS X client can use its FreeNAS AFP share as a Time Machine target; finally, any network share can be used as a destination for an administrator's scripts or programs.
ZFS snapshots also provide a powerful tool for preserving and recovering older versions of data. ZFS snapshots preserve all the blocks in use by files at the time of the snapshot and can be sent to or received from other ZFS-supporting hosts (using SSH or another transport method) as a way of replicating or restoring data from a known point in time.
Snapshots take up only as much space as the metadata used to describe them and, of course, that allocated to the "older blocks" themselves. If you need to recover files from an older snapshot, you can easily clone and share it. If the current version of a filesystem becomes totally useless, the entire filesystem can also be rolled back to the state of a previous snapshot. These capabilities give admins a wide variety of options in creating data preservation and recovery policies.
FreeNAS supports scheduled snapshots in increments as small as five minutes, with preservation times of as little as an hour (Figure 3). As previously mentioned, snapshots can also be scheduled to replicate to a compatible remote system running the same version of ZFS. Snapshot replication only transmits the differences since the last snapshot, conserving bandwidth.
Buy ADMIN Magazine
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Most Popular
Support Our Work
ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.