Bug#475958: document procedure to recover from "/dev/hda became /dev/sda" boot failure
Please let me know if something is wrong or badly written.
It's a great idea to document this problem and ways to deal with it.
It's an extremely unsettling experience to have it occur unexpectedly.
Could I suggest taking your notes one step further, and explaining how to
fix it permanently, or avoid it completely (by doing these steps before
upgrading). I hope there aren't any errors here, I did proof-read it.
I'm not sure if this applies in the same way to platforms other than x86.
--------------------------------------------------------------------
One can avoid this problem entirely, by using an identifier for the
root filesystem that does not change from one boot to the next. There
are two possible methods for doing this - labelling the filesystem,
or using the filesystem's universal unique identifier (UUID). These
methods are supported in Debian since the 'etch' release.
The two approaches have advantages and disadvantages.
The labelling approach is more readable, but there may be problems
if another filesystem on your machine has the same label.
The uuid approach is uglier, but having two clashing uuids is
highly unlikely.
For the examples below we assume the root filesystem is on /dev/hda6.
We also assume your system has a working udev installation and
ext2 or ext3 filesystems.
To implement the labelling approach:
1. Label the filesystem (the name must be < 16 characters)
# e2label /dev/hda6 rootfilesys
2. Edit /boot/grub/menu.lst
Change the line
# kopt=root=/dev/hda6 ro
to
# kopt=root=LABEL=rootfilesys ro
NB: Leave the '#' at the start of the line, it needs to be there.
3. Run update-grub, to update the 'kernel' lines in menu.lst
# update-grub
4. Edit /etc/fstab
Change the line that mounts the '/' partition, eg.
/dev/hda6 / ext3 defaults,errors=remount-ro 0 1
to
LABEL=rootfilesys / ext3 defaults,errors=remount-ro 0 1
The change that matters here is the first column, you don't
need to modify the other columns of this line.
To implement the uuid approach:
1. Find out the universal unique identifier of your filesystem:
# ls -l /dev/disk/by-uuid | grep hda6
lrwxrwxrwx 1 root root 24 2008-09-25 08:16 d0dfcc8a-417a-41e3-ad2e-9736317f2d8a -> ../../hda6
The uuid is the name of the symbolic link pointing to /dev/hda6.
NB: your filesystem uuid will be a different string.
2. Edit /boot/grub/menu.lst
Change the line
# kopt=root=/dev/hda6 ro
to
# kopt=root=UUID=d0dfcc8a-417a-41e3-ad2e-9736317f2d8 ro
NB: Leave the '#' at the start of the line, it needs to be there.
3. Run update-grub, to update the 'kernel' lines in menu.lst
# update-grub
4. Edit /etc/fstab
Change the line that mounts the '/' partition, eg.
/dev/hda6 / ext3 defaults,errors=remount-ro 0 1
to
UUID=d0dfcc8a-417a-41e3-ad2e-9736317f2d8 / ext3 defaults,errors=remount-ro 0 1
The change that matters here is the first column, you don't
need to modify the other columns of this line.
--------------------------------------------------------------------
Reply to: