Hard Drive Weekend

05 Apr 2009

Original Blogger tags: Linux, System Administration, Apple

Aside from being a weekend of UStream studio setup, it has also been a weekend of dealing with hard drives.

I have a PC I built for myself a few years ago, from parts chosen to maximize reliability (an Intel motherboard, Seagate drives, Crucial RAM). It is a dual-boot system with Windows 2000 and Ubuntu, which I’ve more-or-less continually upgraded. It’s been in my closet, but last week at work I needed a Linux box quick for some testing and coding, so I dragged it in, and picked up a used HP flat panel at Affordable Computers on Industrial. Much to my delight I found that the 20” flat panel does 1600x1200 and can be rotated into the portrait aspect ratio, which is fantastic for programming; if the built-in video had a second output, I’d seriously consider a second one. But I’d have to add a video card, and disable the onboard video, and that sounded like too much money and work for the moment, so there it sits.

Anyway, the drive with Windows 2000 on it seems to be failing, although I’m reminded again just how badly operating systems are at letting you know this rather important bit of information. Ubuntu always found lots of problems on it when scanning the disk, and so did Windows, but it did not seem to be able to fix them despite its best efforts, so I decided to pull it and put in a different drive.

I finally figured out how to use partimage to save the whole partition onto an external drive. You have to segment it, so you don’t hit the file size limit on FAT32 volumes. You apparently can’t just use dd, which was my first thought. I had to re-learn how to use parted. Both these tools have somewhat cryptic error messages (the source drive for partimage has to be un-mounted, but you wouldn’t know it from the error message). I used a Knoppix boot CD-R burned for the purpose. Knoppix has apparently gone all 3-D animated, which annoyed the crap out of me; I have no idea why a CD distribution designed for system administration needs to shatter your window into dozens of translucent pieces when you close it. That’s just dumb. All this magic also probably contributed to the two hard lockups I experienced trying to get the backup and restore completed.

I had to do the MBR thing, and then the GRUB thing, and dredge up memories of how to fix a dual-boot when it comes up and just says GRUB. I have fixed them before, but I don’t do it frequently enough to remember what to do when it goes south. I finally found some documentation from Red Hat and it involved a series of 3 GRUB commands. GRUB appears to have a reasonable parser, but it really isn’t reasonable at all; if you type “setup(hda)” it isn’t the same as typing “setup (hda)” or something like that; it doesn’t handle whitespace in a reasonable way at all.

That shocked me a bit, as handling whitespace in text strings is not that hard; in fact, writing a program to break up a line of differently-formatted pieces of text with arbitrary whitespace is, or at least used to be, a very common assignment for a beginning programming class. And there are parsing libraries that make it a no-brainer. No, the author had to work at making the tool intolerant of deviations in whitespace. I remember writing loops in VAX Pascal to skip whitespace circa 1985. But open-source command-line tools are rarely optimized towards making it easy for the end-user.

Anyway, after doing the dd trick for saving and restoring the MBR, the GRUB commands that fixed the boot were along these lines:

grub> find /boot/grub/stage1
grub> root (hda,0)
grub> setup (hda)

GRUB is also monstrously complicated so don’t expect the man page to be much assistance.

As usual, though, the hardest part of swapping out one hard drive and swapping in another was dealing with the physical cabling in the case. I have an Antec Sonata case, which is a very nice case, but even so, you can’t get the drive cage fully free of the box; you have to twist and wrap and fold ribbon cables in a nightmare origami configuration; there isn’t room behind the drive cage for the power and ribbon cables to actually fit neatly, so you have to smash them flat and hope that you haven’t broken any conductors; and even the best PC case I’ve ever seen still has hiding in it somewhere razor-sharp sheet metal. I have yet to do any kind of a PC upgrade — a CPU, memory, or drives — that doesn’t involve sacrificing a small amount of blood.

What would have been really helpful is a case where the back side came off, to allow me to get my hands behind the drives. Barring that, if the entire drive cage came out, that would have been extremely helpful as well. But no, on my Sonata case it is welded in place.

It really, really makes me appreciate the thought Apple put into the Mac Pro (and prior to that, the G5) case!

I’ve never heard anyone take that into account when they talk about the “Apple Tax,” have you?

Creative Commons Licence
This work by Paul R. Potts is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. The CSS framework is stylize.css, Copyright © 2014 by Jack Crawford.

Year IndexAll Years IndexWriting Archive