Monday, June 28, 2010

The little PC that could - resurrecting an old PC as a file server

One of the little PC related projects that I recently undertook was to do something about a backup strategy. I wanted something that I didn't have to think about much; that would perform backups basically unattended. That pretty much ruled out burning stuff to DVDs - too tedious. I did that previously and ended up backing up stuff about twice a year. The other issue is I have two PCs to back up - my main one running Ubuntu linux, the other machine of Mrs Bort that dual boots into Windows XP and Gentoo linux. The second machine also has no DVD drive. The answer came down to three options:

  1. A tape drive. Expensive, I'd also need a SCSI adapter card to put in the machine and buy a bunch of tapes. While capacity would probably be OK, I'd have to get the drive up and running in linux, and if something were to happen to the machine with the tape drive (fire, for instance) I'd not have a way to get the data back without buying a new drive. I never really considered it as an option. 
  2. External Hard drive. I already have an external box, but I think the power connector is a bit flaky. Last time I used it the disk would spin up, down, up again. Wouldn't really trust it. I'd have to buy a new disk drive, something big enough to hold what's on two 250G drives (one in each PC). I then thought, well, if I have to buy a new disk, I could put it in...
  3. A linux fileserver, built from an old PC I had lying around. This is the approach I took, described below.

For sentimental reasons mainly, I still had the case that my first PC came in, a beige Arrow minitower case. Bought from the now defunct Pacific Microlab computers in 1992, with a 386DX-25 chip and a whopping 2 megabytes of RAM. A couple of upgrades later, it ended up with a Gigabyte GA-586TX2 motherboard and a Pentium 233MMX. This is what I decided to base the new fileserver around. Previously it had a spell as a firewall and router, sharing a dialup connection running the excellent IPCop. When I moved to cable internet and a hardware firewall, that could do the same job using only about 7 watts, it was retired.

It is a bit poky nowadays, but with a Voodoo2 card in it I used to have hours of fun playing quake, need for speed 3 and powerslide on it, with quite good framerates. I figured if it could do that, it could probably handle life as a bit bucket, receiving files across a network.

The first task was to buy a hard drive. Since there's about 500GB worth of possible storage on both PCs (not that it would get filled, most is just duplicated as another form of backup) I'd splurge on a 500GB drive. So a Seagate IDE 500GB drive, with 16MB cache was purchased. Since 500GB is way higher than the 8GB the onboard disk controller could read, and its ATA100 interface was far higher than the onboard controller's ATA33 max speed, I used an add in IDE card that is capable of ATA133 speeds. Fortunately I happened to have one of those lying around. I also bought a 100 megabit capable network card to replace the 10mbit one in it. Since everyone wants wireless networks these days, a wired network card was picked up for under ten dollars - bargain! And with better speed, more reliability and less security hassles than wireless as well!

The next task was finding an operating system that would detect the IDE card and be able to boot from it. I initially had installed Damn Small Linux on it for a laugh when it had a 40GB drive (An IBM Deskstar that hadn't died, actually) and intended to use that or a fresh install of Debian. Unfortunately, that used an older version of the linux kernel which didn't yet have support for the IDE card. I considered Ubuntu server but thought it might be a bit heavy on resources - it was going to run in only 64MB after all.

In my search for a linux distro that was light on resources and had a recent kernel, I thought, what about Gentoo? Since it was a source based distribution, any updates have to be compiled, but I could afford to just leave the thing running overnight to let it finish. Plus, I already had a few years' experience running it on the other PC.

So I downloaded an install CD, printed out the current installation guide, put it in the CD drive of the new (old) box and... it booted! And it detected the IDE card. The hard drive was detected as the full 500GB, so there was no hardware issues. A few hours later, I was into a working Gentoo install. Since there was no graphical desktop environment installed, it felt nice and quick.

One cool thing that can be done if you have a few machines is install a program called distcc, which uses the faster machines to offload the compiling from the old, slow machine. This would be great to get running, so I tried setting it up. First of all on the Core 2 Duo machine, but despite following a guide, I had no luck setting that up. Next was the Athlon XP machine. Sure it isn't that quick compared to the E6300, but it is lightning compared to a Pentium 233. After quite a few hours of editing config files, environment variables and swearing, I think it is at a stage where the little P233 hands work to the Athlon to compile, saving a heap of time.

So now it is at a stage where I now have around 450ish Gigabytes of storage, a backup that is scheduled to run on my Ubuntu box (a full backup weekly, incremental backups daily) going to the backup server. Since I also now have two gentoo boxen, the server is now set up to grab the latest list of updates (emerge --sync) every night, and the Athlon box now  points to that for its update list. 

Just a few things need to be taken care of now -  the little fan on the Pentium is pretty loud. I'd like to be able to use a larger, slower fan to cool the CPU and also direct a bit of breeze onto the hard drive too. Getting the disk to power down when it is not needed would be good too, in the interests of the drive's lifespan. Once that is sorted I'll be getting an extension cord and a long network cable, then putting the thing in the cupboard. As long as it doesn't get too hot in there it would also keep the noise down a bit.

Hopefully it will chug along for another few years! 

(Originally posted April 8, 2007 on my other blog)

No comments:

Post a Comment