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

Posted on 2006-06-07
Last Modified: 2010-08-05
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

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

Question by:paries
    LVL 22

    Accepted Solution


    gives you a list of hard drive devices eg:



    Now use e2label:

    e2label /dev/hda1


    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.

    LVL 22

    Expert Comment

    Having said that, if the devices are mounted, then the command:


    Will give you the relationship as well:)
    LVL 3

    Expert Comment

    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...

    LVL 22

    Expert Comment

    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.


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
    If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now