confusing /etc/fstab

Paul F. Almquist paul at almquist.name
Mon Jan 31 14:38:59 UTC 2005


On Monday 31 January 2005 07:35, Paul Howarth wrote:
> Robert Storey wrote:
> > What's confusing to me here is that, in Fedora, I can't figure out which
> > partition is mounted where. Is my / partition /dev/hda3, or /dev/hda5,
> > or ???   Ditto for swap, or any other partition. If I wanted to make
> > some change in the partition table (for example, adding a /home
> > partition) I have no idea how I could get /etc/fstab to recognize it.
> >
> > I've tried making some sense out of fstab-sync, but so far it's pretty
> > opague. Where does Fedora store the partition information? Anybody know
> > some links that can explain this messy filesystem table?
>
> If you just run the command "mount" (you don't have to be root), you'll
> see which partitions are mounted where. You can use either hardcoded
> partition names such as "/dev/hda7" or filesystem label references such
> as "LABEL=/home" in /etc/fstab; either will work OK. You can assign a
> label to a partition when you create the filesystem on it by using the
> -L option in mke2fs, and you can set or change the label of an existing
> partition using the -L option in tune2fs.
>
or display and change labels with e2label

But why label in the first place?  I wondered about that for a while and came 
to this conclusion:  If a drive in an Intel-like box is changed from master 
to slave or primary IDE channel to secondary or some other combination then 
the device name changes, e.g., /dev/hda1 to /dev/hdb1.  When booting after 
this change without fixing /etc/fstab, mount cannot find /dev/hda1 because of 
its new location at /dev/hdb1.  By labeling partitions and using the labels 
in /etc/fstab, mount will search all available partitions for the one with 
the name specified in /etc/fstab (or mount command).  This eliminates the 
problem of device names changing  when modifying the drive configuration.

Labeling does introduce a problem:  What happens if 2 partitions have the same 
label?  Which one does mount choose?  I do not know the algorithm but I do 
know that mount does not know which one you want to use.  In the technical 
college where I taught Unix/Linux system administration we had removable IDE 
drives in our lab machines. (standard IDE drives in a tray that slides into a 
bay the in cabinet.  works good.  I use them at home too)  I had a removable 
drive bay on my office machine. A couple of times I had to make some repairs 
to corrupted student drives.  Since the drives are not hot-swappable   I 
would power down my machine, insert the student's drive, power up and boot.  
Their partition labels were the same as on my internal IDE drive and as a 
result would bet mounted instead of my partitions.  After a couple time of 
messing with that I changed the /etc/fstab file on my system to use device 
names instead of labels.

fsck also recognizes the labels, probably other disk related commands  too.

paul
-- 
Paul F. Almquist
paul at almquist.name
Eau Claire, WI  USA




More information about the users mailing list