Labeling partitions y is very useful to identify volumes by naming rather than by partition number.
To add the label “root” to the root partition, /dev/sda2, you should run:
# tune2fs -Lroot /dev/sda2 # tune2fs -Lvar /dev/sda3
labeling swap partitions can be done with
# mkswap -L label /dev/sda4
Once you’ve got a label you can check it running
# cfdisk /dev/sda
Now, some file must be updated to use this new naming.
- /etc/fstab – this file lists the partitions/file-systems which should be mounted at boot-time
- /boot/grub/menu.lst – this file configures my boot-loader so that the system will boot.
In both cases the change is the same, instead of specifying /dev/sda1 use LABEL=root.
in /etc/fstab file the entry looks like:
LABEL=root / ext3 defaults,errors=remount-ro 0 1 LABEL=swap swap ext3 defaults,errors=remount-ro 0 1 LABEL=var /var ext3 defaults,errors=remount-ro 0 1
in /boot/grub/menu.lst the kernel entry looks like:
/boot/vmlinuz-2.X.XX-X root=LABEL=root ro console=tty0