I had seen labels used in /etc/fstab
and /boot/grub/grub.conf
but never quite got the hung of them, until I read page 170 of Tammy Fox's Red Hat Enterprise Linux 5 Administration Unleashed.
So what I got out of this, was that labels may be listed in place of partitions and while they are not required, they may become useful when a partition number changes, when moving the partition or repartitioning the drive.
The command to use for changing or displaying a partition's label is e2label
. The command must be run as root and the syntax is as simple as :
This sets label to device and if no label is provided, then the device's label is displayed.
So far so good. Now the sad story begins when attempting to change the label of an existing partition of an already used drive, especially the one containing /boot.
When that happens remember to update both /etc/fstab and /boot/grub/grub.conf. Otherwise you risk not being able to boot your system next time. The default label used by the Anaconda installer is "\". So let's suppose that for some reason you decide to change this to CentOS-Root, by issuing something like :
[root@lxbakalidis ~]# e2label /dev/sda1 CentOS-Root
Next thing to do is check your /etc/fstab file and make sure that an entry like :
LABEL=CentOS-Root / ext3 defaults 1 1
is really there and last but not least make sure that grab.conf line that starts your current kernel also references the new label like this:
title CentOS (2.6.18-92.1.22.el5) root (hd1,0) kernel /boot/vmlinuz-2.6.18-92.1.22.el5 ro root=LABEL=CentOS-Root rhgb quiet initrd /boot/initrd-2.6.18-92.1.22.el5.img
Failure to do this right will probably halt your kernel with messages like :
mount: could not find filesystem '/dev/root' setuproot: moving /dev failed: No such file or directory setuproot: error mounting /proc: No such file or directory setuproot: error mounting /sys: No such file or directory switchroot: mount failed: No such file or directory Kernel panic - not syncing: Attempted to kill init!
... and you will probably need a live CD to fix it. For more information refer to the following thread at LinuxQustions.org.
PS: Now I am sure that the last fortune cookie I saw before the crush read something like Good judgement comes from experience, experience comes from bad judgement.
but I was too preoccupied with the coming Friday night joys to take it seriously.
No comments :
Post a Comment