Saturday, 2 July 2011

I've got a tag on this blog called "Whine," which I use for those frequent occasions where things don't go right. I should create a new tag, "Anti-Whine," for those less frequent occasion where they go exactly right.

Replacing my failed hard drive was just such an occasion. So this is The Perpetual Newbie's first official anti-whine.

Grocery shopping

Before going to the store, I did a little online shopping to see what I could expect to pay for a new hard drive. Somewhat to my surprise, I discovered that IDE drives (which my computer supports) are now considerably more expensive than SATA drives, the current standard (which my computer does not support). But, I soon learned, buying a SATA drive is still a bargain, because the price difference is more than enough to compensate for the additional SATA controller card that I would require.

Along the same lines, I opted also to buy a new (IDE) DVD writer. I already had a CD burner. But given that CD blanks are now harder to come by in stores, and that DVD blanks are at least the same price, if not cheaper, this too will pay for itself after a couple of spindles of discs. (It does raise the question of what we're supposed to use to create our own music CDs, but that's a whine for another post.)

So my grocery list for the trip turned out to be:

One Vantecc PCI 6-port SATA controller

One Western Digital 320 GB SATA internal hard drive

One LG "Super-Multi" IDE DVD burner (with a black face, so it doesn't match my 8-year-old beige box, but this is not a whine post)

Paging Dr. Howard, Dr. Fine, Dr. Howard

So with groceries in hand, it was time to mix some metaphors and do some computer surgery. I dragged my case into the living room (where the light's better), and opened it up. A small family of dust bunnies fell out of the case and immediately began doing what bunnies do so well. Back downstairs for the vacuum cleaner hose to give the PC a good internal dusting.

First in was the SATA controller card. While Vantecc calls this thing a "6-port" card, in reality it's a 4-port card, with two ports selectable as either internal (SATA) or external (eSATA). No big deal - I pulled out the manual and figured out which jumpers I had to move to enable the two eSATA ports. Turns out it was all of them. All eight of them. Easy enough to do; fortunately I hadn't cut my fingernails yet.

This computer may be 8 years old, but it still has unused PCI slots, so the next step was to knock out one of the two or three remaining blanking panels on the back of the chassis, then slide the controller card home. Minor snag: these things don't come with screws to hold them to the chassis. No matter. I've got extras. One job down, two to go.

Next up was the hard drive. The Vantecc card came with two SATA cables - but not, to my momentary frustration, a power cable. Obviously the power supply in this antique predates SATA. No matter, I happened to have a Molex-to-SATA adapter in my junk pile. So I plugged it all in and slid the drive into an empty bay.

Last came the burner. This one was simple: jumper it as a slave drive, pull out the old one, and drop in the replacement.

So far, this was turning out to be one of the easiest hardware jobs I'd ever done on a computer. I couldn't help thinking back to the days of my first computer, when IDE cables weren't keyed and the only indication you would get that you'd installed them upside-down was when you booted the computer and nothing happened. But the real question was, what happens when I turn the PC back on?

Nothing happened - nothing out of the ordinary, anyway. The BIOS recognized the new hardware and then the computer booted as usual. Huzzah!

And now . . . we wait

The next step was a software one. Now that I had a shiny new hard drive, I needed to partition and format it. So I opened up Ubuntu's Disk Utility and formatted the entire drive as a single ext4 partition.

Then, I had to copy over the entire contents of /home to the new drive. For the past two years, I've been housing my home directory on a separate partition from root. But I had always planned on going farther, and storing all the /home data on a completely different physical drive. The advantage should be self-evident: if and when I finally replace this machine, I need only install the old drive in the new one to preserve all my old data and configuration. (And buying a SATA drive now also means forward compatibility, an unintended bonus.) It also means that all my eggs aren't in one basket: if my system drive fails, my data is safe; if my data drive fails - perish the thought - then the computer is still usable.

Copying 100+ GB of personal data was extremely tedious, so I left it alone and went to make dinner.

Now, finally, I was into unexplored territory: editing /etc/fstab to tell Linux where the home directories now were. Not that I didn't know how to do this. I just didn't know how it worked. But it looked like all I had to do was replace the location of the old /home partition with the location of the new, save it, and reboot.

And that's exactly what happened. Except for a single desktop file I had uselessly deleted from the old filesystem after migrating it (so it "magically" reappeared on the new desktop), you'd never know I'd made a change at all. This is the beauty of a UNIX filesystem. It doesn't care what drive or partition things are stored on, as long as you've told it where to find them. On a Windows system, the change in drive letters would have resulted in all sorts of headaches from things being broken. But even doing this particular operation for the first time, I had no problems whatsoever.