Frank's Random Wanderings

Building a Do It Yourself NAS

Introduction

NAS (Network Attached Storage) devices, also known as a home server, are pretty common these days. They’re great for having a central point to store files; as a media server for holding photos and home movies; as a place to store backups; etc. Since 2008 I’ve had a 2-bay Synology device, the DS207+. It’s been both reliable and simple to use, but a source of frustation has been my reliance upon Synology to keep its software updated, fix bugs, etc. Technology marches on and Synology no longer supports these units. Synology’s latest software stream is at 4.x and my DS207+ is stuck at 3.x; there are no more feature improvements or bug fixes for me.

The DS207+ is also starting to look rather slow, so it’s high time for a new NAS. This time around I want to avoid the proprietary solutions from companies like Synology, QNAP, etc, and go with something completely open so I can modify it, update it, etc to my heart’s content for as long as I choose. At the same time I’m looking for higher performance, both in network throughput as well as error resiliency. It’s time to roll my own, and this post describes what I ended up with.

UER – The Dreaded “Uncorrectable Error Rate”

We’re all aware that harddisks are not perfect devices – they can fail completely, so backups are super important. What’s less commonly known, but growing in importance as harddisks get larger, is the UER – the uncorrectable error rate.

The simple fact is that harddisks store data on magnetic media, and sometimes that data gets corrupted. Actually, it gets corrupted quite often, so harddisks have sophisticated error detection & correction algorithms (Reed-Solomon encoding etc) to deal with those errors so you never see them. Well, mostly. Sometimes an error happens that the disk cannot correct – this is called an uncorrectable error.

harddisk

The uncorrectable error rate is given in the datasheet for the harddisk, but it’s typically in the order of 1 bit in 10^14 for consumer drives. Some are less, some are more. Consider that 10^14 bits is around 12 TB. Back when you had a 80 GB disk, you’d have to read the entire contents of your disk quite a few times to have a chance of suffering an uncorrectable error. Today 4 TB disks are quite common, and reading that entire disk only 3 times would result in a sizeable chance of suffering an uncorrectable error.

Depending upon the error, you might never notice. If it happened in the middle of a video you would probably never see it. However if it happened in the first few bytes of that video it might corrupt the header and make the video unplayable. If it happened in a program file the program might crash. If it happened in part of the disk filesystem then the impact could be much worse.

Most NAS filesystems blithely assume the disk is perfect. My Synology is like that, as are the vast majority of consumer NAS’s. However some filesystems have the ability to checksum all data coming off the disk, and thereby can detect & correct a harddisk unrecoverable error, even if it happens within the filesystem data itself. The most well-known of these filesystems is called ZFS. I want a system that uses the ZFS filesystem.

DRAM Errors

Harddisks are not the only things that can corrupt your data. Imagine copying your latest home movie from your camera to your NAS. The video data is stored in the DRAM of the NAS during the process of being written to disk. If a DRAM error occurs, then an error will be written to disk in the middle of your movie, and you probably won’t even know.

The error rate of DRAM is higher than the error rate of a harddisk. A 2009 Google study found an average of more than 3000 errors per DRAM stick (DIMM) per year. That’s in a busy server which is always switched on; a home computer is not typically always on and hence the error rate will be lower. Nonetheless, DRAM errors are very real and surprisingly common.

The main solution for DRAM errors is to use ECC DRAM. It’s slightly more expensive than non ECC DRAM (approximately 20% more expensive in my experience), but it has the ability to automatically correct single-bit errors, which is what most DRAM errors are.

Being able to use ECC DRAM requires both a processor and a motherboard chipset that support ECC DRAM. Hence this is a driving force when choosing which hardware to buy.

The Build – Software

There are quite a few pre-packaged NAS software builds available. Some are free, some are not (but the paid ones are still inexpensive), some are open-source and some are closed. Some have good support and some have minimal. I spent quite a bit of time reviewing all I could find, which was a lot. In the end I selected what is likely the most popular build out there: FreeNAS. It’s free, very popular, well supported with lots of help available, a strong feature set, and meets all my requirements (and then some).

freenas

One constraint derived from the FreeNAS decision was their recommendation to choose a motherboard with an Intel network chip. Some other network chips do work, but for a trouble-free install an Intel network chip comes highly recommended.

The Build – Hardware

I already had a PC case and decent power supply, so I needed a processor, motherboard and RAM. My choice:

  • Processor: Intel G3220 3 GHz LGA1150 Haswell $65
  • Motherboard: Supermicro LGA1150 X10SLL-F $158
  • RAM: Kingston ValueRAM KVR1333D3E9S/4G DDR3-1333 ECC $57 x 2 = $114 (8 GB total)

As you can see the most expensive component was the motherboard. Although I could find much cheaper LGA1150 motherboards, I couldn’t find any that explicitly said they supported ECC RAM, nor did they have Intel network interface chips. Although I paid full price, this motherboard does go on sale. I saw it on amazon.com for less than $100 at one point.

To offer up a slightly lower-cost alternative, I’ve seen the following system used by some folks on the FreeNAS forums. Costs listed are what I see on newegg. This is AMD based (not Intel) but it obviously does work.

  • Processor: AMD FX-4300 (3.8GHz) $120
  • Motherboard: Asus M5A78L-M/USB3 $70
  • RAM: as above

So in the end I spent $337 (plus tax) to put together my new NAS. For that money I was quite happy – it’s a similar cost to what I’d spend on another Synology or QNAP, yet fills the criterias I listed at the beginning of this post. In my view, much better bang for the buck.

The only thing remaining is to stick in some drives. I chose Western Digital Green drives, and put them in a simple mirror arrangement. Yes there are “better” drives, but these are cheap, relatively reliable (from the newegg customer reviews), relatively low-power, and due to the simple mirror arrangement are easy to replace if one fails.

How Fast Is It?

My home network uses gigabit ethernet. The only speed number I care about is reading from the system. So I read about 12 GB of data from the freenas server to my PC and timed it. Then repeated the exercise to see if I got the same result. Which was: a read speed of 410 Mbits/sec. (This test required the data to pass through two network switches, and my PC is certainly not cutting-edge any longer. Still, it’s a decent number as far as I’m concerned.)

And The Synology?

It’s still in use. These days it contains a couple of old but still good drives in a JBOD arrangement. About once a week I power it on to perform a backup (automated, using a shell script) from the freenas to the synology. Although it’s much slower than the freenas and I wouldn’t want to use it for daily tasks, it makes a good backup machine. If lightning ever strikes the freenas system, taking out everything including its mirrored drives, there will still be a copy of the data on the synology. As far as I’m concerned, you can never have too many backups!

Leave a Reply

Your email address will not be published.