wnd's weblog

Partition UUIDs and You

14 Jan 2009 08:26:05 Linux

UUIDs are unique (and stable). With Linux, /dev entries may not be. I learned this the (not-so) hard way.

I try to reboot chikan.katei.fi every 100 days to make sure it comes back up after power outage even if I’m not home. I often combine this downtime with non-critical kernel updates. Since I have a cat, I have one more good reason to take a look inside the case every now and then. With an uptime of 188 days I was a bit anxious to see how bad it was. To my big surprise the case was almost as if I had replaced zenoo with chikan just last week. Apparently chikan’s airflow is significantly lesser than what zenoo used to have. Good.

Anyway, to the point. I had performed aptitude update/dist-upgrade and installed linux-image-2.6.24-etchnhalf.1-amd64 prior to shutdown. When I upgrade the kernel on my workstation, let alone upgrade other software, it is very rare that even a single thing goes wrong. However when I’m upgrading my server I’m always very cautious. As Mr. Murphy predicted, the system didn’t come up.

At first the scripts in ramdisk failed to find the system root. I rebooted back to Linux 2.6.18 and rebuilt initrd with initramfs-tools instead of yaird. The root was then found, but fsck failed after checking a few file systems. Since the system seemed fully operational after skipping file system check I was clueless. I was ready to give up when I suddenly realised my root had become /dev/sdc instead of /dev/sda. Interestingly enough the system only had one serial ATA device – the other disks being parallel ATA. Fortunately I had seen how UUIDs could be used in fstab to replace device paths. I quickly fixed fstab, rebuilt ramdisk to be safe, rebooted and voilà, the system was back alive!

Lessons learned? First of all using UUIDs to define your mount points and swap partitions is a Good Idea(tm). Even if the device paths change you can still mount your file system. Second, not all ramdisk creators are created equal. If one fails, try another. I first switched to yaird when initramfs-tools failed to do its job and now I had switch back, albeit on a different system.