Richard Jones' Log: Some Linux "fun"

Wed, 15 Nov 2006

I got a new disk drive from a friend and plugged in last night.

Of course it wasn't easy...

When I booted it up, I got the strangest thing. "Waiting for root file system" which then times out. I don't know if you've ever been thrown into the "ash"/"busybox" minimalist environment that you get when boot fails, but it's not fun ;) I had to try to figure out what was going on ...

It turns out that Linux was trying to mount my root filesystem (sda3) from the new disk - which didn't actually have a partition "sda3". Even though I plugged it in as drive #3 on the motherboard, and the BIOS detected it as drive #3, Linux ordered it as drive "sda" because (presumably) it's an SATA-1 drive and the existing two drives (which used to be sda and sdb) are SATA-2 drives. "1" sorts lower than "2" I guess :)

I eventually figured out that the drives had been re-ordered, and then figured out which files to edit to make it all work again (though there was some guesswork when editing the grub menu.lst). My RAID-1 array was broken as well since it used to refer to sda4 and sdb4 and now it couldn't find sda4 but could find sdc4. I ended up with two RAID disks mounting sdb4 and sdc4 independently. Fortunately I could just delete one and add its disk back to the other array, wait for the rebuild, and all's well again.

Comment by Sean Reifschneider on Fri, 17 Nov 2006

This is one of the situations where mounting a disc from "LABEL=/" instead of "/dev/sdb3" is a win. Of course, if you plug in a disc that already has a partition labeled "/", then you lose, maybe.

The other issue I wonder if you have your RAID partitions set to the right type. Make sure in fdisk that they're "fd" for "Linux RAID Autodetect", and it doesn't matter where the discs end up, the kernel will hunt for them and bring up the array even if the device names have changed.

You could also, of course, use the entries in /dev/disk instead of /dev/sda and the like, particularly /dev/disk/by-id may help here.

Sean