Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 452
  • Last Modified:

where do i find the mapping from label to device in the fstab

Hello,
When i built my fedora 5 box, all the devices that i created at boot are represented by a label in the /etc/fstab

where can i find out what device the label maps to

eg:
cat /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
LABEL=/data1            /data1                  ext3    defaults        1 2
LABEL=/data2            /data2                  ext3    defaults        1 2
LABEL=/data3            /data3                  ext3    defaults        1 2
LABEL=/data4            /data4                  ext3    defaults        1 2


thanks
0
paries
Asked:
paries
  • 3
1 Solution
 
pjedmondCommented:
df

gives you a list of hard drive devices eg:

/dev/hda1
/dev/hda2

etc

Now use e2label:

e2label /dev/hda1

or

e2label /dev/hda2

etc to find the LABEL that goes with each.

man df
man e2label

e2label only applies to ext2 and ext3 file systems. As I only use ext2 and ext3, I am not familiar with anything similar for other fileing systems.

HTH:)
0
 
pjedmondCommented:
Having said that, if the devices are mounted, then the command:

mount

Will give you the relationship as well:)
0
 
leisnerCommented:
I find the labels/querying some maddening.

cfdisk shows the labels.

I've hacked up copies of fdisk to display labels too...

mount can also mount by label (the mount -L command) -- but you still have
to query one at a time...

Remember to query disks youhave to have read permission for the raw device...

0
 
pjedmondCommented:
Before you asked this question, I thought that the concept of adding labels was fairly pointless, as it just appeared to be an additional 'alias' for the device name....but I've finally located a sensible reason for it:

With 'hot-swap' SCSI drives, removing and replacing the drives can result in the device /dev/sdx changing, *BUT* by having a LABEL, that stays the same, and therefore it makes the setup more robust...expecially if you start messing around with rebuilding RAID arrays, with hot standbys etc.

HTH:)
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now