How to ensure sure you can boot if your initrd image has problems


I was playing around with some new kernel bits a few weeks back, and needed to update my initrd image. Having encountered various situations where a box wouldn’t boot due to a botched initrd file, I have become overly protective of this file. Now each time I have to perform an update, I will first create a backup of the file:

$ cp /boot/initrd-2.6.30.10-105.2.23.fc11.x86_64.img

/boot/initrd-2.6.30.10-105.2.23.fc11.x86_64.img.bak.05122010**

Once I have a working backup, I like to add a menu.lst entry that allows me to restore to a know working state:

title Fedora 11 (2.6.30.10-105.2.23.fc11.x86_64.bak.5122010)
root (hd0,0)
kernel /vmlinuz-2.6.30.10-105.2.23.fc11.x86_64 ro root=LABEL=/
initrd /initrd-2.6.30.10-105.2.23.fc11.x86_64.img.bak.05122010

If my changes cause the machine to fail to boot, I can pick the backup menu entry and I’m off and running. If you don’t want to pollute your menu.lst, you can also specify the initrd manually from the grub command menu. Backups are key, and not having to boot into rescue mode is huge. :)

This article was posted by Matty on 2010-05-27 09:31:00 -0400 -0400