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







September 15th, 2008 at 5:00 pm
> 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.
September 17th, 2008 at 10:28 am
Wooo a cool tips for RHEL 3 …
Seriously a good article would have included the new command to replace it.
September 20th, 2008 at 4:43 pm
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.
November 2nd, 2008 at 2:04 am
[...] Red Hat Magazine | Tips and tricks: What is devlabel, and how do I use it? [...]