We haven’t checked in with FreeNAS, the
FreeBSD-based DIY NAS OS, in quite some time. The OS has been completely
overhauled, plugin support has been added, and it now works with even more
hardware
Level of difficulty: Advanced
Length of time: 3 hours
The Mission
Since the last time we built a FreeNAS box,
for the January 2010 issue, the OS has been through some changes. It switched
developers, nearly switched platforms, removed media streaming, added it back
in via plugins, added better ZFS management, and more. FreeNAS promises
near-endless customization and hardware support, enabling nearly anyone to
build a highly moldable NAS from off-the-shelf parts. I’ve been promising an
updated FreeNAS build for quite a while, and now’s the time to deliver. I
assembled a cream-of-the-crop batch of hardware, got the latest version of
FreeNAS. and got cracking.
Choosing the hardware
The beauty of FreeNAS is that it’ll work
with just about any old hardware you have lying around - you don’t need to
build a special box for it. This "build’’ is more about exploring the new
version of FreeNAS than it is about the hardware itself. I took the opportunity
to build a pretty powerful system, but you don’t have to take my hardware choices
as your minimum recommended specs or anything like that. I just wanted to see
what would happen if I gave it beefy hardware to play with.
I chose a Fractal Array R2 chassis, which
has six drive bays and an integrated PSU. I had a Mini-ITX FM1 board and an AMD
A8 APU lying around and decided to use those, because a more capable CPU in
your NAS means better transcoding and streaming. You could just as easily use
any Mini-ITX board with a PCIe slot, maybe one with an integrated Atom or
Brazos chip, if you want to save some money.
![Description: Choosing the hardware](http://programming4.us/image/112012/16/18193666.jpg)
Four Western Digital Caviar Red NAS drives
at 3TB each give me a theoretical 12TB of capacity if I were just going to make
a RAID 0, which I’m not. Because I’ll be using a file system called ZFS, which
does all its volume management in software, I want a good host-bus adapter that
doesn’t insist on imposing its own hardware RAID over it - just something to
pass the commands from the OS to the drives. I picked LSI’s SAS-9207-8i, which
can control up to eight 6Gb/s drives and runs on a x8 PCIe 3.0 bus. Because I
want to use the case’s SATA power connectors, I also bought a HighPoint
Mini-SAS-to-SATA breakout cable rather than use the included connectors, which
run on Molex power.
Because ZFS loves RAM and wants as much as
you can throw at it (the specs recommend at least 1GB per TB of storage), I
used two 8GB DDR3 DIMMs from G.Skill.
FreeNAS won’t mount any storage on the boot
drive, and only takes up about 2GB total (with another 2GB swap), so there’s no
point wasting a hard drive on it. It’s perfectly happy booting from a flash
drive. I just used an 8GB drive left over from a CES press kit.
Set it up
Since this is a very straightforward build
but a complicated software install, I’ll skip the step-by-step build entirely,
and start with the software configuration. It’s a bit of a doozy. Thankfully, I
have the excellent instructions on Freenas.org and the FreeNas Quick Start
Guide (http://doc.freenas.org/index.php/Quick_Start_Guide)
to help. Here’s how to set up FreeNAS; create volumes; set up users, groups,
and sharing; and install a few streaming plugins.
Install the OS
To create the bootable OS image (from a
windows machine), you’ll need the aforementioned USB drive, the programs
7-Zip (www.7-zip.org) and Win32 Disk Imager
(bit.ly/N3QiJT). and the img.xz file for your install. We’re using FreeNAS
8.2.0 Release 1. Download the FreeNAS-8.2.0-RELEASE-p1-x64.img.xz file from
SourceForge fbit.ly/ N3Qvq7). Extract the img.xz file using 7-Zip to turn it
into an .img file, then burn that file onto your USB key with Win32 Disk
Imager. This might take a few minutes. Once it’s ready, plug the USB key into
one of the FreeNAS box’s rear USB ports and turn on the machine. You’ll need a
keyboard and a monitor for this, but only for a few minutes. Make sure the
FreeNAS box is connected to your network via Ethernet. Make sure the system is
set to boot from USB. The system will spend a few minutes doing a self-test and
then dump you at a screen called Console Setup. At this point, under a list of
11 options, you should see the phrase "You may try the following URLs to
access the web user interface,’’ followed by an IP address. Go to another
computer on your network and enter that address into the web browser; you
should be able to get right into the web console, which will make this whole
process a lot easier (image A).
![Description: image A](http://programming4.us/image/112012/16/18194666.jpg)
image
A
You’ll notice a blinking Alert light on the
upper right. Click it and you’ll see that you need to change the admin
password. Hit the Account button to the left of the Alert button, then select
Change Password. Changing the admin username from "admin” can help with
security too. You should also set up an email address for the root account, so
FreeNAS can email you with admin alerts. Go to Account, then Users, then View
Users, and click Change Email on the root account. You should also set up
console logging by going to System > Settings > Advanced and selecting
Show Console messages in footer.
Set up storage
Now for the fun part: volume management.
Thousands of words can be and have been written about the relative merits of
the various traditional RAID levels, as well as ZFS-specific types like RAIDZ1
and RAIDZ2. Any choice will be a trade-off between performance, capacity, and
robustness. I’m going with RAID-Z2, which will allow me to tolerate up to two
disk failures without data loss.
Go to Storage > Volumes > Volume
Manager. Create a volume name (I used "mpcstore"), then hold Ctrl and
select the drives to use - I used all four drives. For filesystem type, select
ZFS, then RAIDZ2. Select Add Volume. My four 3TB drives created a volume of
6TB; I’m sacrificing space for redundancy.
Inside the volume, I’ll create individual
ZFS datasets so I can set granular permissions on each of them. Because I’m the
first user, I’ll create a dataset within mpcstore for myself. In the left
navigation pane I’ll go to Storage > Volumes > /mnt/mpcstore and select
Create ZFS Dataset. I’ll call it ‘‘nedstore" and give it an unlimited
quota (image B).
![Description: image B](http://programming4.us/image/112012/16/18195666.jpg)
image
B