Simple instructions for renaming drives

Michal Jaegermann michal at harddata.com
Wed Dec 20 23:22:40 UTC 2006


On Wed, Dec 20, 2006 at 09:57:52PM +0000, Paul wrote:
> 
> Currently, I have a pile of /dev/hdX's in my fstab file. Do I just
> rename these as /dev/sdX

I would rather suggest that you replace those with
LABEL=<my_label_for_/dev/hdX_here> if these have ext2/ext3
file systems (or anything else which can be labelled).
If you never bothered to put labels on these, or you want
to change them then this can be done quickly with the following
script:

#!/bin/bash

# read from stdin pairs 'volume_name label' and label ext2/ext3
# file system with these data

me=$(basename $0)

while read dev lab ; do
    echo tune2fs -L $lab $dev   # just a visual check
    tune2fs -L $lab $dev
done
exit

You make files with lines like

/dev/hda5 home_my_home

and later you feed data from that file into the script above.

You can put also a label on a swap but for that you have
to do 'swapoff -a' followed with 'mkswap -L ...' with a label you
want and 'swapon -a'.

> and what do I need to do in my grub file to get
> things to work?

Change in /etc/grub.conf 'root=/dev/hdX' to 'root=LABEL=<label_for_/>'
I am not sure if anything in initrd is using particular labels.
Redoing initrd after those changes seems to be prudent and at least
not harmful. :-)

With that you should be able to boot does not matter how kernel
is calling your devices.

OTOH I do not know how LVM will take to name changes; so if some of
your partitions are on LVM volumes then booting may turn out to be
"interesting".  Just guessing here but files in /etc/lvm/archive/
are using "hard" names although those places are commented with
"# Hint only" so possibly this is ok too.
 
   Michal




More information about the test mailing list