Rate this page del.icio.us  Digg slashdot StumbleUpon

Tips and tricks: What is devlabel, and how do I use it?

by The editorial team

Devlabel is a script which manages symbolic links to storage devices on your system. This is accomplished by utilizing the inherent unique identifiers (UUID) that each device should have in order to maintain a correctly pointing symlink in the event that the device name changes (eg. /dev/sdc1 becomes /dev/sdd1).

By adding entries using devlabel, users can instead reference all devices by their symlink and no longer have to worry about what the true name of their device is. Devlabel works with both IDE and SCSI storage.

Devlabel first tries to find the uuid of the partition that you are attempting to add to devlabel by using the /usr/bin/partition_uuid program. Partition UUIDs are supported currently under ext2, ext3, xfs, jfs and ocfs. If no partition UUID can be found (or if it is not a partition you are adding) devlabel will then attempt to find either a SCSI uuid or IDE identifier.

To determine the unique identifier associated with a SCSI device, devlabel uses the program /usr/bin/scsi_unique_id. If this program cannot determine a unique identifier for your block device then the device cannot be used with devlabel.

Example usage of the devlabel command can be found below:

  • Add a device to be managed by devlabel

    devlabel add -d  -s
    

  • Remove a devlabel symlink

    
    devlabel remove -s
    

  • Report the status of all devlabel symlinks

    devlabel status
    

  • Get the UUID of a particular device

    devlabel printid -d 
    

Once a devlabel has been configured files such as /etc/fstab can be modified to reflect these changes and point to the symlink rather than the physical device itself.

The configuration file for devlabel is /etc/sysconfig/devlabel. This file tracks all the current device symlinks. It is not recommended to edit this file by hand.

The devlabel command is available from the devlabel package for Red Hat Enterprise Linux 3 and onwards.
For further information see the Red Hat Enterprise Linux System Administration Guide http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/sysadmin-guide/ch-devlabel.html

Red Hat’s customer service and support teams receive technical support questions from users all over the world. Red Hat technicians add the questions and answers to Red Hat Knowledgebase on a daily basis. Access to Red Hat Knowledgebase is free. Red Hat Magazine offers a preview into the Red Hat Knowledgebase by highlighting some of the most recent entries. The information provided in this article is for your information only. The origin of this information may be internal or external to Red Hat. While Red Hat attempts to verify the validity of this information before it is posted, Red Hat makes no express or implied claims to its validity.

4 responses to “Tips and tricks: What is devlabel, and how do I use it?”

  1. Karel Zak says:

    > The devlabel command is available from the devlabel package
    > for Red Hat Enterprise Linux 3 and onwards.

    The devlabel is DEPRECATED package and the latest available release is in RHEL3. It does not exists in >=RHEL4 any more.

  2. Nicolas Aizier says:

    Wooo a cool tips for RHEL 3 …

    Seriously a good article would have included the new command to replace it.

  3. Christopher Cashell says:

    This is a useful tip for RHEL 3, but as Karel and Nicolas have stated, it’s a little bit dated, and not applicable for newer releases.

    For those looking for a devlabel alternative or replacement in RHEL 4/5+, udev is what you need to look into. You can use udev rules to setup the same sort of mappings to ensure that a given disk/LUN will always show up under the same name.

    udev is included and supported in RHEL 4 and later.

  4. This Week on MA.GNOLIA « /home/kOoLiNuS says:

    [...] Red Hat Magazine | Tips and tricks: What is devlabel, and how do I use it? [...]

Leave a reply