Find the device of a label

If you run Red Hat or Fedora, your /etc/fstab file for the /tmp directory might look like this:

LABEL=/tmp /tmp ext3 defaults 1 2

The “LABEL” command is hiding the true name of the device that provides the mount point for the /tmp file system. How can you tell what the device really is? The “tune2fs” command will reveal this information. The syntax for the tune2fs command is as follows:

# tune2fs -l /dev/hdaX |grep volume
# tune2fs -l /dev/sdaX |grep volume
# tune2fs -l /dev/cciss/c0d0pX |grep volume

The first command is for IDE drives, the second for SCSI drives, and the third for Compaq RAID arrays.

It helps to know, in advance, the partitions that are already defined on your server. If you don’t know the partitions, run this command against each one until you find the partition with the label. In practice, this command on an HP Proliant server might look like this:

# tune2fs -l /dev/cciss/c0d0p7 |grep volume
Filesystem volume name: /tmp

Note that the grep returned the LABEL of the filesystem’s volume: /tmp. In other words the /tmp LABEL is really the device at /dev/cciss/c0d0p7.