Using Filesystem Labels in Linux

Ist2_3533724_yellow_sticky_note When rebooting a RHEL box with a whole bunch of SAN luns I ran into an issue where the system was failing when trying to mount a device ( /dev/sdm). When I logged into the box in single user mode this device did not even exist. However, it was brought to my attention that a few luns where removed from this box recently, so apparently when I rebooted the box generated a new device list, and my renamed /devd/sdm to something different.

Apparently this is common.As the simple act such as adding or removing a
LUN can cause Linux to remap your /dev/sd entries, causing what used to
be /dev/sde1 to become /dev/sdd1. This problem can be solved by using filesystem labels, which are entries in the ext3 filesystem header.

have found 2 ways of doing this.

First is with e2label, Usage: e2label device [newlabel]

You can also show your label as below. In this instance my label is 'storage'

root@kubuntu:~/downloads# e2label /dev/sdb1
storage

Or you can use tune2fs

L argument to set, l to show a whole bunch of stuff

tune2fs -L storage /dev/sdb1

root@kubuntu:~/downloads# tune2fs -l /dev/sdb1
tune2fs 1.40.8 (13-Mar-2008)
Filesystem volume name:   storage
Last mounted on:          <not available>
Filesystem UUID:          1cc16930-8891-4307-97fb-e267117dead1
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super large_file
Filesystem flags:         signed_directory_hash
Default mount options:    (none)
[truncated]

Then make your changes to the fstab, both entries below are same, just one uses the newly assigned label.

#/dev/sdb1      /mnt            auto    rw,user,noauto,exec     0       3
LABEL=storage   /mnt            auto    rw,user,noauto,exec     0       3

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.