Monday, May 28, 2007

Subterranean data center

I've been getting paranoid lately about data loss.  This was almost certainly prompted by a disk failure at my old business that caused some actual data loss.  As seems to happen a lot, the disk failure also disclosed a failure in our otherwise sensible-seeming backup program, with the result being that I lost several months of archived e-mail, among other things.  Disk failure rates seem to be on the rise; the combination of rising areal densities and the public's clear choice of "cheap" over "reliable" virtually guarantees it.  (See, for example, http://australianit.news.com.au/story/0,24897,21553519-15321,00.html.)  And with larger capacities, the negative consequences of a disk failure is that much greater.

So, about six months ago I embarked on a domestic data infrastructure program to reduce my risk.  This includes:

  • Relocating my server system to the basement, where the temperature is probably more to its liking (and where additional noise was not going to bother me).  This necessitated running lots of Cat 6 cable through the walls; I put a gigabit switch in the basement and ran cable runs to most of the rooms where data would be needed.  (Lesson learned: no matter how many cable runs you think you need, run more.  Pulling 2 wires is only marginally more expensive than pulling one...) 

  • Attaching a RAID array to the server system.

  • Getting a hosting provider with reasonable storage limits where I can put some of my data so it is accessible from off my own private network.

  • Migrating all critical data into SVN repositories.


For the RAID system, I put a 3Ware 9500S-4LP hardware RAID card in my Linux system (about $300). This has four SATA ports.  The reason I went with hardware RAID instead of motherboard RAID (sometimes called "fake hardware raid") is that the hardware solution seemed to offer more in the way of hot migration and upgrades.  Building my own RAID system turned out to be more of a hassle than expected, mostly because I ended up ordering parts from mutiple vendors because no one carried all the parts I needed.  I bought the RAID card and the drives (three 500G drives) for a total of $850.  I bought a four-bay enclosure from Addonics.  I opted to spring for "multilane SATA", which allows multiple SATA drives to be connected over a single cable; this required adapters at both the enclosure side and the system side, since both the enclosure and the system just had four regular internal SATA connectors.  (Running four cables from system to enclosure seemed like it was asking for trouble.)  The trickiest part turned out to be getting the right SATA multilane cable; turns out there are two different types of SATA multilane connectors (screw type and latch type), and many enclosures and adapters are vague about which kind they need.  So I ended up buying the wrong cable first, and then had to buy the right kind from sataparts.com.  Once I got the RAID system physically put together, it was pretty easy.  My Linux distro already had the right 3Ware driver installed, and the controller had a nice web interface that let me configure the volume set.  With RAID 5, the three 500G drives show up as a 1TB SCSI disk, which I partitioned using LVM. 

I could have bought a NAS box, but six months ago the choices were pretty weak. (I suspect this has gotten slightly better.)  Would have been less hassle to put together, and maybe cheaper, but I'm sure there would have been compromises too.  I'm pretty happy with the hardware RAID solution, and I've got a choice of upgrade paths.  (I could throw another 500G in, and have it rebalance the data across four drives giving me 1.5TB, or when the cheap 1TB drives come out, I can pull one 500G out, let the array run in "degraded mode", throw two 1TBs in, create a "degraded" RAID set from them, move the data, then pull the 500G drives and put the third TB drive in giving me 2TB.) 

My system is on my home network, which is connected to the internet using via a consumer-grade NAT firewall.  So getting out is easy, but getting in is hard.  I could have gone the dynamic DNS route, but I chose instead to get a hosting provider for files that I wanted access to from outside.  I set up a hosting account at www.textdrive.com, which is great.  They make it really easy to set up SVN, WebDAV, etc, so I set up two SVN repositories on my hosted system for files I need roving access to (such as presentation slides, in case I get to a conference and my laptop doesn't.)  I set up two because SVN doesn't have good support for actually removing things from repositories, so they tend to grow over time.  So there's a "permanent" and "transient" repository; the transient repository is for short-lived projects where after some point I won't need the history any more.  SVN turns out to be a reasonably nice solution for accessing the same file from multiple systems, since I tend to either be at home and use my desktop system exclusively, or be on the road and use my laptop exclusively. 

I decided to get all my data into SVN, after being inspired by this article from Jason Hunter.  Even for data that you don't think is ever going to change, like photos (hey, what about photoshop?), SVN turns out to be a pretty good solution.  If you get a new computer, you can just do one checkout and all your data is there.  Keeping an up-to-date checkout on your home and laptop systems (in addition to the server) mitigates a number of data loss scenarios.  I'm not there yet -- I'm still migrating, but I'm making progress. 

The big question mark now is the backup strategy -- backing up a terabyte is pretty hard.

4 comments:

  1. What do you do about power consumption? I thought for a while about keeping one of my systems on 24x7 but its power consumption, even at idle, is about 150w. This would add about $30/mo to my electric bill. (Of course I'm in California, where electricity is notoriously expensive.) Fortunately, the Squeezebox can use wake-on-LAN, so I can leave the computer asleep, consuming 5w intead of 150w. I can probably afford $30/mo but I find the energy consumption to be objectionable.

    ReplyDelete
  2. Well, I always had the server system for development purposes, so I didn't bring any incremental systems online (though the additional drives certainly draw a lot more power.) I suppose I could activate some of the power management features in Linux; I've never thought much about that for desktop systems, but I should. I don't know what it draws, but I pay about 14c/kwh, so a 100W draw should run me about $10/mo. Do you know anything about power management for non-laptop Linux systems? Would it make sense to have it spin down the drives when they are not being accessed?

    ReplyDelete
  3. Turns out there's no way to get the 3Ware raid controller to spin down the drives when idle. Ugh.

    ReplyDelete
  4. Instead of RAID, how cool would a Drobo supported SVN repos be? (note: neither do I work for Data Robotics nor own Data Robotics stock).

    Regarding power consumption. I've been using a 1 GHz mini-itx system (w/ a VIA chip), w/ 300 Gb drive running Suse 10.2 for slimserver and other similar "server" like activities... its wimpy but fine for most uses. Using a Watts Up? pwoer meter, it draws 50 watts under high stress and 30 watts during idle times... not great but better. I also have a wrtg54 running dd-wrt and its a very frugal device, power-wise... nice.

    ReplyDelete