I've been running home servers in one form or another for about a decade. For me, the server has shifted from a convenience--a place to store files that I want to access anywhere and an easy way to stream music to the office for free--to a necessity. Today, my home server is a place to back up my family’s computers and the home for all of my media--a few hundred ripped DVDs and Blu-rays plus my family’s music collection and all of the photos and home videos we’ve shot. Like any other server, it also serves as a good place to store the files I need access to all the time, as well as host any services that work better when they’re always running—stuff like dynamic DNS, streaming servers, and game servers.
My first home server was simply an old gaming PC that I repurposed by installing Linux and setting up a few shared folders and an FTP server so I had access to files at home when I was at the office or travelling. For the last five or six years, I’ve been running a lightweight Windows Home Server v1 machine packed with hard drives. The WHS box had some real advantages—it’s novel filesystem made it so simple to add storage that I eventually ended up with about 8TB of available space. Unfortunately, its ancient Celeron processor was woefully underpowered to stream 1080p video, and the OS has been effectively abandoned by Microsoft.
When I decided to build a new server late last year, the first thing I did was figure out what I wanted to use it for. Easy backups for a handful of Macs (and one PC) across the network was a must. I also wanted a machine that would be able to stream all of my media--using Plex Media Server to stream ripped movies and TV shows and Subsonic to stream my music collection. I needed a safe and secure place to store my personal media--photos and home videos I've shot. Finally, I wanted to offload the heavy lifting of DVD and Blu-ray transcoding from my main desktop PC, and the ability to add new stuff to the machine that I haven’t even thought of yet.
When I was deciding what operating system to use for my next home server, I investigated a handful of Linux options, briefly considered Windows Home Server 2011, and finally settled on FreeNAS, which is a customized version of FreeBSD. FreeNAS makes it relatively simple to set up a multi-purpose machine that can run headless—that is, without a video card or monitor connected. After taking FreeNAS for a test drive in a virtual machine, I was sold. As an added benefit, FreeNAS’s native filesystem, ZFS, makes it easy to add multiple hard drives to a single volume, and even supports using a SSD as a smart cache for the volume. And yes, if you want, you can even add redundancy to the system (I don’t recommend it, but we’ll get into that later).
Figuring out the hardware for the FreeNAS machine was tricky. While you can buy dedicated network-attached storage devices that come pre-configured with FreeNAS, none of the options in my price range had the kind of high-powered CPU I was hoping for. After spending the last two years wishing my server was faster, my goal is to make this motherboard and CPU last at least five years, maybe more. Knowing that, the option I was left with was to build a machine and install FreeNAS on it myself.
First, I had to figure out the hardware part.
The main rule with FreeNAS is to load up your machine with as much memory as you can afford.
The good news is that storage, which should be the main expense in a home server, has never been cheaper. For about what I paid for my old Windows Home Server (and a few parts that I’ve upgraded on other machines) I was able to put together a beast of a machine with about 10TB of storage, a hexacore CPU, and a ton of memory. In short, it’s enough to do anything I’ll want to do for at least the next five years, and hopefully more. If you’re interested in building your own server, you can build as big or as modest a machine as you’d like. And yes, my original trick, of turning my old gaming PC into a server still works—although a newer rig will likely be more power efficient than your old gaming machine.
Here’s the hardware I chose. The main rule with FreeNAS is to load up your machine with as much memory as you can afford. The recommended configuration is 1GB of RAM for each terabyte of storage in your ZFS volume; however, that seems less important once you cross 8GB of RAM. Two parts of this rig are probably overkill for most people—I splurged on a 6-core CPU so that I could use this machine as a dedicated DVD and Blu-ray ripping server and I chose a pricey Platinum rated power supply to minimize the amount of energy that’s wasted as heat.
- CPU - Intel i7-5820K Haswell-E Hexacore - $400
- Motherboard - Asus X99-A - $250
Memory - 16GB Crucial DDR4 - $180(Editor's note, after having some conversations with readers, I'd recommend buying ECC SDRAM. This may change the rest of the machine. More to come ASAP)
- Hard drives - HGST 4TB NAS Drives - $165 each
- Power Supply - Corsair HS760 - $150
You can choose any case you happen to have, and you'll need at least one USB thumbdrive, possibly two. I didn't use one of these for my build, but I wish I'd bought a smaller thumbdrive than the one I ended up using. FreeNAS recommends running ECC memory because of the way the OS is installed, but I’m regularly backing up the machine, so I didn’t want to spring for much more expensive ECC DDR4 memory.
The only real problem I have with my server is that it's a power hog, especially compared to some of the lower-power CPUs available today. If you want to build something that's more power efficient, I'd get a quad-core Pentium CPU on a motherboard for about $150, run 8GB of RAM, and minimize the number of hard drives. The Pentium uses a fraction of the power that the Haswell-E I chose uses, but it won't be as capable when it comes to live transcoding video in Plex, and it only supports four hard drives.
A Note on Hard Drives
Until recently, there hasn't been good data on reliability of hard drives. Recently, online-backup provider BackBlaze started posting failure rates for the drives the company uses in its storage cloud. After looking at the available choices, I decided to get a specific model of HGST 4TB drive designed for use in servers and NAS boxes. While there are larger drives available now, this model of 4TB drive has been around for long enough to develop reliable data. Equally important, the price per gigabyte for these drives hit the sweet spot for me.
FreeNAS stores the operating system on a USB thumbdrive and copies the OS from the thumbdrive to RAM at boot time.
Installing FreeNAS is a multi-step process. First, you need to burn the installation ISO onto a USB thumbdrive or a DVD-ROM. Then, you to make sure both the installation medium and the thumbdrive you’re going to install the OS on are plugged into the machine, and that the BIOS is set to boot the machine from the installation media. After the machine boots, you’ll need to answer a couple of prompts, including selecting the proper drive for installation. It’s OK to do the install with your hard drives disconnected if you’re worried about accidentally installing FreeNAS on one of them instead of your thumbdrive.
Wait, what? You’re supposed to install the OS on a USB thumbdrive? Indeed you are. FreeNAS stores the operating system on a USB thumbdrive and copies the OS from the thumbdrive to RAM at boot time. Once it’s booted, it connects to the filesystem on your hard drives. The beautiful thing about this approach is that your FreeNAS install isn’t tied to the hardware in any particular machine. To move your FreeNAS install to another machine, you just need to move the hard drives and thumbdrive, set the BIOS to boot from the thumbdrive, and your server will be back up and running in no time.
Once you’ve been through the initial install, FreeNAS will prompt you to reboot the computer. When it reboots, you’ll be presented by FreeNAS’s console menu. At this point, you can point your web browser to the IP address FreeNAS lists at the bottom of the screen. If everything is working properly, you’ll see a login prompt for the FreeNAS web interface. (If it doesn’t, you may need to use the console to configure your DNS server and default gateway.)
After you change the default password, FreeNAS presents you with the initial configuration wizard. While you can skip this process, I recommend walking through it, as it will help you set up a ZFS pool with decent default settings and create your first few network shares.
There are a few things you should know before you jump in. The first is that ZFS, while incredibly powerful, is unlike the filesystems you find on desktop OSes. To get the most out of ZFS, you really need to span the filesystem across multiple disks. Each group of disks is called a pool, and while FreeNAS will let you have multiple pools in your system, you probably only need a single pool for a home server. ZFS lets you configure the redundancy level for a set of drives at the pool level. While I generally recommend using a using a striped pool and backing up your data regularly instead of a mirrored setup, if you have the hard drive space, mirroring will help you recover from a dead hard drive faster than backups.
Inside each pool you can add datasets. Datasets in ZFS are roughly analogous to folders in more traditional filesystems; however, each dataset can have unique settings for quotas, permissions, and other features. I generally recommend creating one dataset for each type of media. That means you’ll want one dataset for videos, one dataset for music, one for photos, one for Windows backups, one for Mac backups, one for BSD jails, and a catch-all place for files that don’t fit one of the other categories.
Once you’ve created the datasets, the FreeNAS wizard will help you create the appropriate file shares. By default, most people should choose the CIFS option when it’s time to select the share type. CIFS shares are supported by all the major desktop operating systems, but you will need to enable an AFP share if you plan on backing up your Macs to the server using Time Capsule.
At this point, you should have a working FreeNAS box. Now you need to create a group for all of your users—I called mine “Users”, add users, and add that group to the permissions for each dataset and share.
Now that your machine is up and running, The first thing you should do is enable snapshots. Snapshots are on-disk backups that save the state of every file on the ZFS pool. FreeNAS makes it easy to set snapshots to run automatically according to a schedule. WARNING: Snapshots don’t really protect against data loss from hard drive failure—mirroring or a good backup scheme will take care of that—but they will help you recover if you accidentally delete the wrong file. Even better, snapshots are essentially free. Each snapshot simply stores the differences between any files that have changed since the last snapshot, so they’re very small. I set snapshots to run on my ZFS pool every couple of hours, and each one is retained for several weeks.
Next, you can install some plugins to extend your server’s capabilities. You'll want to check the FreeNAS plugin documentation for plugin-specific installation instructions for anything that you want to try. FreeNAS plugins run in FreeBSD jails, a kind of virtualized environment that's connected to, but still isolated from the main machine. If you're just getting started, it's worth installing Plex (video streaming in and out of your home), BTSync (an easy way to keep files synchronized between devices), and Subsonic (music streaming in and out of your home). These three plugins were relatively simple installs, however some of them require jumping through substantial hoops.
Before you fill your machine with data, you should devise a backup solution. You can simply copy the data on your ZFS pool to a drive in another machine using BTSync or rsync, or take advantage of FreeNAS's integrated backup tools rsync or Crashplan. Backing up a large server is a pain, but at least FreeNAS gives you plenty of options.
We've just explored a fraction of what's possible using FreeNAS. Using virtual machines, you can run game servers for yourself or a Minecraft server for your kids. You can even use your FreeNAS machine as the anchor of your independent personal cloud service. Or, you can simply use it as a place to back up your local machines and store a few video files. It's up to you!