SYS: Configure systems to mount file systems at boot by Universally Unique ID (UUID) or label
Note: This is an RHCSA 7 exam objective.
Mount with UUID
UUID stands for Universal Unique ID. It is 128-bit value that uniquely identifies a disk or partition of a disk.
To get the list of disk UUID, type:
# blkid
To define the disk or partition that you want to mount (here lv_vol) and append it to the /etc/fstab file, type:
# blkid | grep lv_vol >> /etc/fstab
Then, edit the /etc/fstab file and change the new added line with the correct parameters (here /mnt as mount point, ext4 as file system type, etc).
UUID=".." /mnt ext4 defaults 1 2
To mount the disk or partition, type:
# mount /mnt
Mount with label
In addition to UUID, a disk or a partition of a disk can receive a label. It is a string of at most 16 characters long in the case of ext2/ext3/ext4.
To assign a label to a disk or partition (here /dev/vdb1), type:
# e2label /dev/vdb1 TEST
or
# tune2fs -L TEST /dev/vdb1
To get the label associated with a disk or a partition (here /dev/vdb1), type:
# e2label /dev/vdb1
TEST
To mount an ext4 formatted partition (here /dev/vdb1), edit the /etc/fstab file and paste the following line:
LABEL=TEST /mnt ext4 defaults 1 2
To mount the disk or partition, type:
# mount /mnt
Leave a comment