How to build a NAS
Andrew Everard
Tuesday, November 27, 2012
The (almost) simple guide to setting up network storage for your music, and (at least some of) all you need to know about RAID and backups
You know Parkinson's Law? The one that says 'Work expands so as to fill the time available for its completion'? Well, the same's true when it comes to storing music – however much storage you have, the size of your music collection will expand to fill it before you know what's happened.
And if, like me, you find yourself getting antsy when you're up to much more than 60% of the available space being filled, that means it's going to be time to get yourself some more storage.
So it was that, little more than a year on from my last great NAS-building adventure, my 2TB network-attached storage drive was beginning look a bit full, and it became clear that a deep breath and another project was in the offing.
What spurred me on was the announcement of the NAS-optimised Red drives from Western Digital, designed to run to run 24/7 in the high temperatures often found inside NAS housings, handle the noise and vibration found in multi-drive arrays, and to give the user an easy time should a problem occur, as well as speeding up any recovery required.
Reading about them, I found myself thinking 'NAS' again, and determined to build something with sufficient capacity to keep me futureproofed for a while.
That meant four drives to offer a variety of RAID options – more on that in a moment –, and also a new enclosure to supplant my existing D-Link cheapie, still doing solid work but grinding away slightly wheezily in its location hidden away in a cupboard.
DIY for flexibility
It's possible to buy a complete NAS for plug and play operation, such as the WD MyBook World with which I started out, but for flexibility it's best to buy a separate enclosure and drives. The enclosure is the physical box you plug into your system, containing the Ethernet interface and the computer to control the drives, which are mounted inside it.
Which enclosure? Well, asking around some friends in the know, and spending some evenings reading up, studying manuals and looking at various interfaces, led me to the QNAP TS-412, which I picked up for under £250.
While I was waiting for it to arrive, a large box containing four 3TB Reds arrived from the nice people at WD – now I really had no excuse for procrastination. It was time to get on and put the thing together.
It's really not that tricky, even for a fumblefingers like me: four sheet-metal caddies slide out of the QNAP – you just lift a latch and pull – and the drives are fixed to them using four little screws provided. It's only a tad fiddly, but the design makes it impossible to do it incorrectly and when you slide the caddy back in the connections on the drive mate up with those on the enclosure.
By the way, if you're daunted by all this stuff, there's a number of providers selling online who'll sell you an enclosure and drives installed, tested and even set-up with the configuration you want. I had conversations with Ultimate Storage , which offers a free set-up and configuration service when you buy an enclosure and drives – I was told the procedure adds two or three working days to the order time, as the discs have to format and then initialise in your chosen RAID configuration.
As an example, the grand total for a QNAP TS-412 fitted with four 1TB WD reds, giving a total or 2-4TB of storage (depending on configuration) was around £650, whereas the same housing and drives from Amazon was around £575. Other suppliers offer similar services.
Discs loaded, the QNAP was powered up, hooked up to the network and the mains, and off it went checking and formatting the discs. A few hours later, a long beep signalled all was done.
Time to RAID
Well, that bit was easy – now for the set-up, and here we take a short diversion into the wonderful world of RAID: those in the know look away now, because this is going to be really basic stuff.
RAID stands for Redundant Array of Independent Disks, and what it isn't is a back-up system. While it's designed to spread your data over multiple hard disks, so that in case of failure it's possible to recover the data, if the software in the NAS administering the array – or the hardware RAID controller – fails, there's no guarantee you can retrieve what's on the disks.
So the point to take from this is that even if you have a RAID set-up on your NAS, you really need at least one entirely separate back-up – as in a second NAS, or an offboard HDD able to contain everything on your main NAS.
And you need to make sure you either have an automatic back-up strategy in place – my second storage kicks in at 1am each morning, and copies over any changes made on the main NAS since the last back-up – or are scrupulous about doing manual back-ups.
After all, you really don't want to spend ages re-ripping or re-downloading your entire collection.
RAID 0 is no RAID at all. The advantage is that you get the full capacity of the disc(s) you have installed – so four 1TB drives will give you 4TB of space, but the disadvantage is that if one drive fails, you'll lose all the data.
RAID 1 duplicates the data between two hard drives to provide disk mirroring. So install two 1TB hard drives and format as RAID 1, and you get a total capacity of 1 TB, but with the reassurance that, if one drive fails, the data is recoverable.
RAID 2 and 3 involve synchronising the rotation of the disks in the array, and storing sequential bits of data on successive drives. The main difference between the two is how the parity data – used to check discs are storing the correct main data – is stored: across the drives in RAID 2, and on a dedicated parity drive in RAID 3.
The same dedicated parity drive is used in RAID 4, which allows the other drives to spin independently: the problem, of course, is that the parity drive performance dictates how the whole array will perform. And if the parity drive fails…
The next most commonly used configuration is RAID 5, requiring at least three discs, which distributes parity data - used to check discs are storing the same data - across the three drives, and can tolerate the failure of one drive while still offering recovery. The capacity offered by our three 1TB drive-in RAID 5 would be 2TB.
RAID 6 requires at least four drives, and can tolerate two drives failing, but again will offer 2TB of capacity from four 1TB drives. As an alternative, you could configure a four-drive system as RAID with a hot spare, meaning the array runs RAID 5, but one drive is kept unused, ready to kick in should one of the three active drives fail.
Being a bit 'belt and braces' when it comes to this stuff, I'd opted for the RAID 6 approach, and set the QNAP chugging to set up the array. This takes a long time – a day or more in the case of the 4 x 3TB set-up I was using – and while that was going on two things happened to cause a rethink.
One was a discussion suggesting that RAID 6 would be working the QNAP's processor too hard, and that RAID 10 would be a better bet; the other was a power interruption during the formatting process sufficient to set me back to the 'install the drives and re-initialise' stage.
Now I'm not blaming the family member who unplugged the NAS unit to plug in the Dyson, but...
So, RAID 10 it would be, in which data is striped across two discs and mirrored to the other two. It can stand two discs failing, gives the same capacity as RAID 6, and avoids – so I'm told - hammering the processor so hard, thus giving better performance.
Phew! The only downside, I'm informed, is that writing is slightly slower, which could explain why it took several days to copy from my old NAS to the new one. Fortunately I set up an old netbook computer to run the copy software – the excellent MuCommander – , meaning at least I could keep on working.
That and a combination of watching the NAS remotely from the Gramophone office via QNAP's web manager, and a wife between jobs and thus at home to click the 'retry' button on netbook on the couple of occasion the copying stalled, meant it didn't take any more than – well, a few days, anyway!
Once-only task – hopefully...
At least it's a job you only need to do once, and while this part of the set-up was grindingly slow, subsequent uploads are considerably faster than they were with my old D-Link running Seagate hard drives, and the QNAP enclosure runs sufficiently cool and quiet to enable it to be used in the main listening room.
The D-Link often did an impersonation of a Phantom jet running its engines on full power waiting for the deck catapult to be fired, and so was banished in disgrace to a cupboard.
Serving media is simple: the QNAP comes with a service called QPKG allowing you to load a selection of 'apps' according to your requirements, and I soon had the old familiar Twonky media server software up and running in its latest form, and talking quite happily to the various media players in the house, which currently include an Onkyo TX-NR818 network receiver and a Naim NDS/555PS combination.
Remote access
The NAS also allows me to access and administer the server remotely (from the office, should I want to), and even play content over the Internet to portable devices wherever I happen to be. So should I need some music for reviewing or listening when not at home, I can play it via an iPad, iPod or iPhone, or download it on my laptop and copy it to a USB stick to plug into the front of whatever's being tested or listened to. Neat.
And I've done some other tweaks to the system: the occasional loss of connection between player and NAS, or iOS control device and player was due to some IP address allocation confusion in the Virgin SuperHub we have – a 'known problem', apparently –, and so that's now been switched into modem-only mode and an Apple AirPort Extreme brought in as a router for Ethernet and Wi-Fi.
This connects down to the Netgear switches hooking all the music components together, so wireless is now only used for the control devices for the system – currently a new iPad mini, proving its suitability as the perfect remote control for streaming music systems.
It's all very glitch-free now, and connections between controller, network player and NAS are both rock-solid and much faster.
Oh, and I've also added an uninterruptible power supply for the QNAP, which senses any power failure and kicks in battery power to give the NAS time to shut down smoothly.
And that last purchase proves that, even in this age of digital music, the possibilities for tweaking – and that audiophile thing of just buying stuff – are still limitless...