For a while now I have been searching for a NAS (Network-Attached Storage) appliance for my home office -- one that is inexpensive, supports CIF, AFS, Subversion, and above all, is quiet. I didn't find one, so I built one.
For a while I've been starting to bump into the upper limits of my disk storage. The storage needs of my paperless home office was quickly outgrowing my current disk capacity, causing me to be constantly trolling for files to delete. The combined with multiple subversion repositories, VMWare virtual hard drives, developer kits, SDKs and operating system distribution ISO images was quickly consuming my local hard drives resources.
Still, I resisted the urge to throw down the cash for a NAS appliance.
However, when my quirky 1TB SimpleTech USB drive (I do not recommended purchasing SimpleTech's external drives by the way) started throwing I/O errors, and I couldn't get it to format, I knew it was time to start searching for something better.
My critical data was safely stored on RAID-1 array, but I knew from experience RAID sometimes provides a false sense of security. With a sense of urgency, I again started looking at NAS appliances.
At first, I looked at a variety of 4-bay NAS appliances. The least expensive 4+ bay NAS (Promise NS4300N SmartStor) was priced at $292.99, and the most expensive was the ReadyNas 4TB was priced at $1479.99.
What surprised me most was that the reviews of these appliances have an average three stars (out of five). Furthermore, in every model I investigated there were complaints about quirky firmware issues, extraordinary disk format times, poor tech support, and above all, poor performance.
Clearly, there had to be a better way.
I ultimately ended up salvaging parts from various dead PCs to create an inexpensive "Junk Yard NAS." I junked a total of 3 PCs and kept the most modern -- the Althon64 (3800+) powered HP Pavilion a1510n. The Athlon 64 3800+ came out in 2004 with a frequency of 2.4GHz and 512KB of L2 cache. Clearly, we aren't going to win any races here. I also purchased two (2) 2TB drives for an all in cost of $400.
Take 1: Gentoo (Goodbye RAID, Hello Nightly Disk to Disk Backup)
First, I installed Gentoo. Within a few hours I had a fully functional, but minimal system. I installed Gentoo on the first drive and broke the 2 TB drive into three partitions: a boot partition, a swap partition, and a data partition.
Next, I started to make a clone of the system drive. In the event of a drive failure, I could just pull the drive and use the backup as a boot drive. This would be especially important when the second drive was in a removable drive tray I could take with me in the event of a fire or other disaster.
1: dd if=/dev/sda of=/dev/sdb
Unfortunately, I quickly figured out that doing a nightly disk to disk backup (with the dd utility) of a 2TB drive would take weeks at 20MB/second. A nightly disk to disk backup would be impossible.
Take 2: Gentoo (Goodbye dd, Hello rsync)
Next, I used fdisk to parition the second disk. For convenience, I copied the boot partition:
1: dd if=/dev/sda1 of=/dev/sdb1
Next, I formatted the data partition, mounted the second disk and then used rsync to copy the contents of the root directory to the second drive:
rsync -ax --delete --force --exclude /mnt/mirror / /mnt/mirror/
Lastly, I setup a nightly cron script to copy the system disk to the backup disk. It worked flawlessly for several weeks until I decided to try out FreeNAS (see the next part).
Labels: Gentoo, Linux