Mounting drives by label
John Reiser
jreiser at BitWagon.com
Sat May 24 12:41:14 UTC 2008
> I've labelled my drives using e2label and they're now being recognised as
> home_drive, audio_drive and devel_drive. I can only sometimes mount them
> using fstab as it looks like the labels aren't being used, but the last /dev/
> sd* is (for example, /dev/sde1 might be audio_drive, but then on the next
> boot, /dev/sdf1 is audio_drive but then the system fails on booting with the
> error that /dev/sde1 is mounted).
>
> There is nothing in /etc/mtab, but the problem seems to occur when the system
> is rebooted after the shutdown procedure didn't work correctly.
>
> Any ideas on this or what I should file it under with BZ?
If /etc/fstab contains lines such as
/dev/sdf1 /dir1 ext3 defaults 2 2
then you are at the mercy of the random order in which the system recognizes
drives (sde, sdf, etc.) It is somewhat curious, but not necessarily a bug,
if the order changes upon reboot after a failed shutdown (and no hardware changes.)
If /etc/fstab contains lines such as
LABEL=audio_drive /dir1 ext3 defaults 2 2
then the first partition with label "audio_drive" should be mounted as /dir1.
It is up to you to keep the labels unique. Duplicate labels commonly occur
after moving drives from system to system, because neither people nor anaconda
reliably choose unique names ("/", "/1", "/home", "/boot", etc.)
If /etc/fstab contains lines such as
UUID=xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /dir1 ext3 defaults 2 2
then the first partition with the specified UUID should be mounted as /dir1.
There is only a *very* small probability of collision in UUID, as long as
you don't copy partitions with a "blind" copy command such as 'cp' or 'dd'.
"tune2fs -l /dev/sdf1" shows the UUID of the ext3 filesystem in the
partition /dev/sdf1.
--
More information about the devel
mailing list