Building a NAS Server

September 14, 2011 by . 34 comments

After reading a review of the Drobo FS, I became obsessed with network attached storage (NAS). I realised that a NAS device would neatly solve a couple of long-standing problems I hadn’t got around to fixing: data backup and data organisation.

This post will explain how I picked the hardware and software for my NAS.

My NAS server

To buy or to build?

The Drobo FS itself, while a compelling product, is expensive. There are also some worrying stories of problems with poor read/write speeds, noise, and the slightly ropey client software. But mainly, I feel it’s my duty to build my own computers.

Nevertheless, maybe you run a small business and prefer to think of a NAS as an appliance – something that has a warranty and a customer support email address. This is where the pre-build solutions from Drobo, Synology, ReadyNAS, etc., excel. SmallNetBuilder is a great resource for finding out more about that sort of thing.


I guessed that 4 x 2TB hard drives with single-drive redundancy would suit me, leaving a usable space of around 5.5TB. With that settled, I could pick the hardware:

Hardware montage

  • CFI A7879 Mini-ITX NAS Server Case (£98.40 from LinITX)
  • Atom 330 CPU (dual-core) + ASUS AT3IONT-I Mini-ITX motherboard + fanless heatsink (£112.83)
  • 4 x 2TB hard drives (£240 total)
  • 2GB memory (£19.99)
  • 2 extra SATA cables (£3.65 total)
  • 2GB USB boot drive (pretty much free)

…totalling £474.87 (about 770USD). This is almost exactly the cost of a 5-bay Drobo FS, without drives, at £476.54!


The case was a little expensive, but it does the job well. Some basic instructions would have been nice – it took 5-10 minutes of fiddling to figure out how to get drives inside. The other 4-bay NAS case option I found, the Chenbro ES34069, was even more expensive. (For a 6-bay NAS, the Lian Li PC-Q08 got a decent review, but the Fractal Array R2 did not.)

CPU and motherboard

I chose the motherboard because it hit the sweet spot of price, power consumption, number of SATA ports, and availability. Also, FreeBSD supports the Ethernet chipset, which was important (see below). Newer Atom CPUs, such as the D510, should be more power-efficient overall because of the on-die memory controller and graphics, but none were readily available.

Temperature, noise, and power

I wanted to minimise noise, so passive CPU cooling appealed to me. The case includes a PSU fan and a 120mm case fan, which are fairly quiet. The motherboard does dynamically adjust the case fan speed based on the CPU temperature. CPU and hard disk temperatures are normally 35-45°C, depending on the ambient temperature. The hard disks can be noisy when seeking.

The normal total power consumption is about 43W. This is while running a BitTorrent client, and so all four hard disks are spinning. I’m fairly happy with this, because the drives are benchmarked at about 4W idle, and 5.6W while seeking. Because the NAS will be running 24 hours a day, it should cost about £43 a year to run (1W roughly equates to £1 over a year).

If I turn BitTorrent off and allow all the drives to power-down to standby mode, power consumption drops to about 29W. For comparison, the Drobo FS is rated at about 12W (idle) and 56W (busy), with four drives.

NAS porn


Picking hardware was time consuming, but relatively painless. Software was a lot trickier to nail down, given all the options:

  1. FreeNAS, using ZFS
  2. Plain FreeBSD, using ZFS
  3. Solaris, using ZFS
  4. Linux and mdraid (software RAID)
  5. Linux and ZFS, via ZFS-FUSE
  6. unRAID
  7. OpenFiler
  8. Greyhole
  9. NexentaStor
  10. OpenIndiana
  11. Windows Home Server (2007 is often preferred to 2011 because of the Drobo-like Drive Extender)

The only easy part was that I wouldn’t settle for anything less than ZFS. (The next section explains why.) This eliminated Linux (I didn’t want ZFS-FUSE because of the performance implications) and OpenFiler. I also ruled out unRAID, NexentaStor, and Windows Home Server, because they (can) cost money. Greyhole looks like a great idea (similar to ditto blocks in ZFS), but I didn’t want to have to manually split my data into “important” and “unimportant” bins. Also, parity-based redundancy is far more efficient, in terms of hard drive space, than the full mirroring offered by Greyhole – especially as more drives are added.

Why ZFS?

“End the suffering” — Jeff Bonwick & Bill Moore

ZFS originally stood for Zettabyte File System (due to the immense storage limit of 256 x 1015 zettabytes), but it is much more than just a file system. Importantly, it is also a kind of logical volume manager (LVM). That means that ZFS likes to control both the allocation of physical drives to logical storage entities (vdevs and zpools in ZFS), as well as the organisation of files within those zpools. This gives ZFS significant power, compared to a layered approach.

For a NAS device, a couple of features are worth looking at in more detail: data integrity and RAID-Z.

Self-healing data

ZFS really cares about keeping your data safe. CERN – which famously handles a lot of data – did an experiment with 3000 hardware RAID cards. They experienced 152 cases of silent data corruption within three weeks. Although slightly mystical-sounding, bit-rot really can happen.

In order to provide the so-called end-to-end data integrity, ZFS simply stores checksums away from data blocks. In fact, the checksums themselves have their own checksums further up the chain, and so on until the root of the file system (known as the uberblock). The entire file system hierarchy is a self-healing hash-tree. Here’s a simplified diagram:

Simplified ZFS hash tree example. Note that data is only at the leaves.

Going from left to right, directory 1 contains a pointer to file A, file A’s checksum, and some other meta-data. But dir 1 is just another data block, which is pointed to by the uberblock. The uberblock therefore contains a checksum of dir 1, and so on. This does mean that every write to a file involves recalculating several checksums, all the way back to the root node (the uberblock). But ZFS’s copy-on-write policy (see below) and transactional nature mitigate the performance penalty. Furthermore, ZFS is designed to take advantage of Moore’s law: CPU cycles are cheap, but hard drives are slow.

This all means that ZFS can check your data at any time — and it can often repair data after a variety of problems.

RAID-Z: fixing RAID 5

ZFS’s answer to RAID 5 is called RAID-Z1, but it has important advantages over hardware RAID 5. RAID-Z avoids the dreaded write hole, where loss of power during a write operation can (silently!) leave the data drive and parity drive inconsistent. In ZFS, the copy-on-write policy solves this problem because ZFS always writes to a new block, and then atomically updates the block pointers:

A copy of the file system structure is made when in the process of writing new blocks. If a drive failure happens during the write, the original data is still accessible and the file system knows that the write operation didn’t complete.

RAID 5 also has a performance problem with partial stripe writes, because the old stripe data must be read before being modified and written back. RAID-Z uses dynamic stripe width, so all writes are full-stripe writes and this problem can never occur.


What is it, and why do I need it?

FreeNAS is based on FreeBSD, but with a few clever changes that make it great for NAS servers. Naturally, it inherits FreeBSD’s ZFS support, if a little out of date. I decided to use FreeNAS, rather than any other ZFS-capable OS, for two main reasons:

  1. The boot-from-scratch philosophy makes backing-up and restoring the entire OS (well, the XML settings file, not a binary image) very simple. If anything ever goes badly wrong with the OS, I just burn the OS image to a USB drive and upload the settings file. Nothing to install, nothing to configure. It also means that the OS is not stored on a data drive. And booting from USB ensures that the OS does not use up a valuable SATA port. (In fact, FreeNAS boots from USB and copies the OS to a RAM-disk for two reasons: 1) the OS is “clean” at each boot, as described above, and 2) to minimise writes to the flash memory.)
  2. FreeNAS’s purpose-built web interface means that you rarely need to ssh into the server and use commands to get stuff done. In fact, once it’s up and running, you rarely need to touch anything.

FreeNAS 0.7 main web interface

Lots of extras

FreeNAS should have everything you need from a NAS server:

  • Set up SMB/CIFS, FTP, NFS, and AFP shares
  • Transmission BitTorrent client, with its own web interface (24-hour downloading/seeding!)
  • rsync
  • SSH
  • iSCSI
  • Dynamic DNS
  • DAAP
  • UPnP
  • S.M.A.R.T. monitoring and email alerts
  • Manage users
  • Network interface link aggregation

Version 8?

There was one last decision. Version 8 is a complete rewrite of version 0.7, but many useful features are still missing. Also, I couldn’t write a bootable USB image for 8 (although the CD image worked ok in VirtualBox). For now, 0.7 is the only choice.


Who cares about how elegant the OS and file system are; more importantly, how fast is it? Well, not great, but not bad. Without any significant tuning, and using SMB shares, I get 20-30MB/s for sustained reads and writes, over gigabit Ethernet:

Copying a file from NAS to laptop

Sadly, it seems that the RealTek NIC (or FreeNAS’s driver) doesn’t support jumbo frames; the MTU setting in FreeNAS won’t budge over 1500 bytes. Wireshark confirmed that no packets exceeded 1500 bytes. But, there is still some tweaking to be done…

What now?

A NAS server is a huge step forward from the horrors of USB external hard drives (or, further back in time, burning DVDs and CDs…) for backups. Aside from filling the NAS with 5.18TB of data, there are minor improvements to look at:

  • Setting up email notification for hard drive S.M.A.R.T. attribute thresholds.
  • Power and temperature improvements form underclocking the CPU, and ensuring that the GPU is powered-down.
  • Improving read and write speeds or, at least, pin-pointing the performance bottleneck.

Other practical notes

  • It’s important to note that RAID-Z1 (single-drive redundancy) is not really recommended. If a single drive fails, the strain of resilvering, which may take a long time, might knock out a second drive. All data would be lost. RAID-Z2 provides dual-disk redundancy for this reason. (All of my work and important personal documents are backed-up with Dropbox; the data on my NAS are somewhat expendable.)
  • Although Solaris offers the most up-to-date ZFS support, with features such as de-duplication and snapshots, I didn’t plan on needing these and so I was happy to settle for the older version of ZFS in FreeNAS 0.7.
  • The SATA ports in the case are close together, and I was lucky to only have two L-shaped SATA cable connectors; otherwise they would not fit.
  • The case also has a 2.5″ hard drive bracket, which is intended to be used for the OS/boot drive.
  • Booting from USB automatically with the ASUS AT3IONT-I motherboard is not obvious. You need to pretend the USB drive is a floppy disk drive.
  • Initially, I toyed with the idea of an integrated NAS and HTPC, but decided that there would be too many compromises; dedicated devices would be far better. For example, FreeNAS is great for ZFS support and other NAS tools, but how would I get a driver for ION-accelerated HD video out of the HDMI port? The hard drives are also too noisy for a HTPC. As an aside, the Boxee Box works really nicely as a dedicated HTPC.
  • btrfs should be great one day when it’s ready, but ZFS does the stuff that’s important for a NAS now.

Further reading of ZFS and NAS building


Subscribe to comments with RSS.

  • Linker3000 says:

    Thanks for a really clear and concise write up – excellent post.

    If you don’t fancy building a system from scratch, and/or want to save some cash, you should consider the HP Proliant Microserver into the hardware mix – you get:

    AMD Athlon II Neo N36L / 1.3 GHz dual core processor 1GB RAM (8GB max) Gigabit NIC 250GB hard disk in one of… 4 SATA drive bay caddies Spare bay for optical drive ‘Cube’ case approx 25cm square 6 USB (1 internal) and 1 eSATA port 1 year next day warranty

    The best thing about this ready-to-go box is that it lists at £239 INC VAT but as of 14th Sept 2011 in the UK there’s a £100 cashback offer – so that’s a whole working box for £139!!

    Based on the pricing in the article, this makes a build:

    1 x Proliant Microserver £139 1 x 2GB DDR3 RAM £17 4 x 2TB hard drives (£240 total)

    Ready to go for £390 with a spare 250GB SATA drive for future use!

  • MBraedley says:

    I’d just like to point out that the client software for the Drobo, at least for Windows, was recently updated with a much improved GUI. Functionally, it’s not that much different, but it definitely looks a lot better.

  • Good post and good choice going with ZFS.

    Is 2GB RAM enough? My feeling is that ZFS is happier with as much RAM as you can afford. Maybe a small-ish SSD and put the ZFS ZIL there?

    I’ve had a Solaris 10+ box as a NAS for a couple of years and it’s been a very good experience. You get a lot of good ZFS-stuff with Solaris that I don’t think the BSD-port has yet. Encryption, deduplication etc.

    (And all the very good Sun tech in Solaris — DTrace, Zones etc)

    Makes me a little sad that the whole Sun-OpenSolaris-Oracle-Solaris enchilada makes me less likely to choose Solaris for my next NAS-machine. I liked the thought of Solaris 10 as a userland Linux with a more “grown up” and stable base, but now I’m not sure I trust Oracle enough.

  • Gordon says:

    I went down the Proliant Microsever route aswell, although I plumped for Windows Home Server 2011 (it’s only about £35 now).

    Part of me wishes I’d tried FreeNAS first though as configuring WHS is a bit of a pain – after 8 weeks of on-off fiddling (family, work etc. keep getting in the way!) I’m still to get it running exactly the way I’d like, serving media to my HTPC and desktops/laptops.

  • Stephen Hill says:

    Hi Jeff,

    Excellent article! Just one questions:

    What model of hard drives did you buy? Did you opt for full speed 7200 drives or ones with a slower spindle speed?

    I would also be interested why you chose one of the other.

    Many Thanks Stephen

  • sblair says:

    @Linker3000 Thanks! I didn’t find that HP device when I was building my NAS, but it looks like a decent option. The eSATA port could be handy.

    @MBraedley I’ve maybe been a little unfair with Drobo, Synology, etc. I’ve not used their products, and they do make it really easy to add/swap drives.

    @Styler Never heard of SnapRAID, but it does look promising.

    @Erik I’ve heard that ZFS is memory-hungry, but I think 2GB is enough at the moment. The reported memory usage is usually at about 25% or less. But, I’ve not done any detailed benchmarks yet, so I could be way off…

    @Stephen Thanks – even if I’m not called Jeff! I went for 5400rpm “green” drives. I was happy to trade a bit of performance for power efficiency. I also intentionally refrained from mentioning the hard drive brand (well, there is a hint in the post) because I didn’t want to risk starting a pointless anecdote-based HDD reliability war…

  • Jon L says:

    Great article, nice to see custom builds still taking priority.

    One question, where did you buy your mobo + cpu bundle from?

  • sblair says:

    @ JonL I bought it from Amazon UK, in April this year. It’s out of stock from there at the moment though. There might also be better alternatives available, such as the Asus AT5NM10T-I, but I’ve not looked around much recently.

  • Isaac C. says:

    Great article, but I have a question. The golden features of the Drobo are 1) that you can use any drive size (they don’t all have to be the same), 2) you can remove a drive or it can fail (or more than one – depending on the model) without loosing any data, 3) and you can continually upgrade the capacity by simply swapping in larger drives.

    My question is: Are any of the above features replicated in your NAS build? I would LOVE to build my own NAS, but those features are incredibly useful, and I would hate to loose them.

  • sblair says:

    @Issac With ZFS, it’s already possible to do 2) using RAID-Z. And 3) can be done, but it’s not ideal at the moment. See this question and this question for more details.

    Technically 1) is possible with ZFS, but, depending on the arrangement of drives to vdevs, I think ZFS will be limited by the smallest drive. The Drobo FS does make better use of drives of different sizes: see their guide for more info.

  • john says:

    I can say that one of the reasons I like my hardware RAID is that you can just attach it to any old computer and it shows up as an external hard drive. So I have 4x2TB drives in a case, attached to my PC via eSATA, but I can attach the case to a laptop via USB if need me. This is a good solution if, like me, a Free BSD-based NAS case is a bit beyond your skill level.

    I can also say, avoid Drobo! The slightest perturbation, even not shutting it down correctly, will corrupt the whole thing. I’d rather back up to a Western Digital My Book Essential than a Drobo; they’ve given me nothing but bad luck.

  • sambeau says:

    Is it not risky to buy 4 identical drives from the same manufacturers at the same time? I have heard of similar drives failing at the same time (or very close to each other at a time of high stress e.g. while trying to recover data)

    Why didn’t you spread the risk among different drives?

  • parityboy says:


    In your list of software/OS candidates, you forgot FlexRAID. In topology it’s closest to RAID 4, but it deals with parity of file blocks, rather than disk blocks. Think of binary uploads on Usenet, and you’re in the ballpark.

    The advantage of FlexRAID is that it doesn’t use striping, so any drive can be pulled from the array and read like a single drive. Also, each drive is accessed independently, so the other can spin down and save power.

  • Daniel says:

    I would like to improve in the design by replacing the Motherboard with a E35M1-I (NOT Deluxe edition) and adding a Vertex 3 of 60, to keep OS and Storage separate, and improve boot perfomace (maybe install a few emulators 😉

    anyway is a great article 😀

  • Daniel says:

    I would like to improve in the design by replacing the Motherboard with a E35M1-I (NOT Deluxe edition) and adding a Vertex 3 of 60, to keep OS and Storage separate, and improve boot perfomace (maybe install a few emulators 😉

    anyway is a great article 😀

  • vermaden says:

    While FreeNAS/FreeBSD/OpenIndiana (or generally ZFS powered systems) are great choice for NAS, I would also advice trying DragonflyBSD which comes in with their own filesystem HAMMER:

    Also, at least on FreeBSD, the RAM requirements for ZFS are quite overblown, I have my NAS on FreeBSD 8.2-STABLE amd64 with 1GB RAM and I have there 2TB ZFS mirror more then 90% full, I share that data using SAMBA and NFS and I do not have any stability problems, the uptime is only gone because of lack of power (no UPS).

    % uptime 6:20PM up 108 days, 8:22, 1 user, load averages: 0.00, 0.00, 0.00

  • I toyed around for years to get the best NAS possible. from OEM to home made. this summer i got a Synology DS411j. It does all, i mean ALL, i want, it’s great, low power (11-31W), awesome UI with regular updates, full root shell powered by IPKG (i can install pretty much any CLI app for linux). Put the volume with JBODs and coupled it with CrashPlan for offsite backup and a local disk of most of the data (using 1.5T of the 4x2TBs WD Green drives). That means only two drives usually spin up. the NAS costed 335€ (305€ on amazon UK). way cheaper then your home made solution.

    for a home made machine i considered having XEN/KVM and put FreeNAS + XMBC. could work for u too.

    I miss ZFS… a LOT. but cant have everything 🙂

  • darkbyte says:

    I’m using a Debian NAS with zfs-fuse and I’m getting near 50Mb/s reading from a samba share. Using 6x2Tb disk in a raidz1 configuration with 8Gb and a Corei3 CPU. So far zero problems with zfs-fuse.

    Only 2cents.

  • Jim says:

    Interesting read. The bottom line is you can always build a cheaper/faster RAID than one from Drobo, etc. No surprise there.

    For those that (a) are technically capable of building our own RAID, but (b) value our time, there’s Drobo. I loved my 4-bay FireWire Drobo and love my 5-bay Drobo FS even more. I regularly get 40MB/s read and 30MB/s write which is plenty fast for my home network which includes the occasional streaming of multiple HD movies off the Drobo.

    John – Sorry you may have had a bad experience with your Drobo, but I don’t think it is responsible to make a blanket statement. My experience has been flawless and I would regularly yank the power cord to power down my 4-bay. The new Drobo FS stays powered on 24×7 (drives spin down after 15 minutes with no activity), so not an issue with the FS. I will say we had a power outage recently and the FS came back online beautifully.

  • bourne says:

    I have been looking for a solution for my current dlink NAS. I am just about at my capacity and have been looking for a replacement but nothing on the market really peeked my interest. Plus, with a phone to consider backing up, having a device with a lot of flexibility would be nice.

    This sounds like it would give me exactly what I want! Thank you for posting!


  • ChefJoe says:

    Just this past weekend I updated my E3400, Intel PCI-E GigE, 4x 2TB Samsung 5400 RPM drives, LianLi PC-V354b NAS from 2GB of RAM on 0.7.2 FreeNAS to 8GB of Ram on 0.8 FreeNAS. The drives are in RaidZ1. My transfer rate via SMB went from around 40-45 MB/sec sustained to around 75-80 MB/sec sustained, ~110 MB/sec burst (transfer size smaller than RAM).

    Something to consider if building new. The 6GB minimum recommended for RaidZ on FreeNAS 0.8 costs a fair bit more in DDR2 than DDR3, but if transfer speed is important the additional ram seems to help (kind of unfair to compare FreeNAS 0.7 to 0.8, I know).

    With the transition from 0.7 to 0.8 and the growth of RaidZ popularity I see a real fork between the old idea of FreeNAS being on older, low end hardware and FreeNAS with RaidZ requiring more memory to run well (and small NAS boxes with 2 slots for memory pretty much needing DDR3 to achieve the density cheaply).

  • Gibus says:


    Nice article!

    I also made my own NAS based on a Asrock A330GC motherboard and two 1TB disks. It uses ZFS too but with ZFS-fuse (0.6.9) on a Gentoo Linux. I only use a 2 disks mirror ZFS pool as disks were expensive back then 🙂

    At first, I also thought that using fuse would lead to poor performances but transfers between Windows and SMB shares achieve sustained 30MB/s writes and 35MB/s reads (I don’t think jumbo frames are enabled).

    Recently, I replaced my Windows system disk with a SSD and now reads are up to 40MB/s. So, I use to think that bandwith was limited by the client-side disk transfer rates.

  • ansx says:


    I had pretty much the same idea, except for one thing: I noticed the existence of which is a decent ZFS implementation on GNU/Linux. I built my NAS/HTPC using Ubuntu and XBMC, which makes everything very easy to handle. I posted a few articles on how I built & installed the device there:

  • Nnyan says:

    How about array expansion? lets say I have one pool in a Z2 pool(?) with eight 3TB drives (18TB pool right?). A few months later I want to add two more 3TB drives (total of 10) will I now have a 24TB pool or an 18TB and 6TB pools?

    • sblair says:

      @Nnyan You would have two vdevs: the original ~18TB vdev (with RAID-Z2) and the new vdev (using 2 * 3TB drives, in some configuration). Both could be added to the same pool, at any time. But failure of the new vdev — e.g., if the new vdev was aggregated (non-redundantly) and there was a failure of either of the new 3TB drives — would kill the entire pool. But, the users would see their storage pool magically increase by ~6TB, so it’s a trade-off.

  • Great article. I hadn’t considered zfs for a filesystem/layer solution but am considering an upgrade to my home server that has been chugging along with gentoo linux for seven years. A while back I was looking for a reason to dabble in bsd – you may have given it to me.

  • Dimitris says:

    Great article! Could you plese tell us the HDD models? Where can I find a 2TB hdd for (240/4) 60?

  • Jared says:

    would love to hear the thoughts on building this nas with ubuntu and zfs rather than freenas. Also what sort of changes you might make if you did it today….

  • Chris says:

    This was a great write up! I am looking into building my own NAS and gained a lot of insight from your build. I am curious though, you used 4x2TB drives in a ZFS pool and still have over 7TB of total storage. I set up my FreeNAS box using 3x3TB drives in a ZFS pool and was only able to get a bit under 6TB total storage space in the pool. Do you know why that might be?


  • Chris says:

    Indeed I do. Thank you for clearing that up. I was looking at the screen shot you posted of the web interface and have been scratching my head. Are you still using Transmission as your BT client? Has it worked out well for your setup?

  • tschi says:

    Hi, did you configure WOL with freenas and AT3IONT ? I tried with nas4free (freebsd 9.1) and AT3IONT but I can’t not able to make wol thx

  • Phil Veale says:

    I’ve been going through this recently wondering what to use on a NAS project I’m about to start. I have got the hardware already, I’m using a Mini-ITX board with an AMD APU and a chipset that supports 8 SATA ports, it has 7 on the board +1 eSATA. Case is Mini-ITX Lian Li with 7 “Hot Swap” trayless bays.

    I’m stuck on the choice of OS. Ubuntu supports ZFS natively now, and that’s appealing, but so is a more proven solution such as FreeNAS 8 or NAS4Free. I do also partly question “do I really want ZFS?” – the reason perhaps for not doing it is that the disks may well be quite mixed in size. I can’t really imagine a decent ZFS config where you have 2x 500GB disks, 2x 1TB, 2x 1.5TB and a 3TB drive, for example. You’re going to end up wasting a lot of space, somewhere.

    I contemplated the idea of creating RAID-Zs from vdevs made of 500GB partitions, spread across the disks and then shoving them all into one Zpool but this seems messy and it’s suggested the performance takes a hit. This might not play with will FreeNAS/NAS4Free either, and perhaps I’d be better off using OpenIndiana/Nexenta.

    Any advice for what to do, given the changed availability of software 2 years after this article was written?

  • Leave a comment

    Log in
    with Stack Exchange