Labeling partitions or volumes is a file system feature. There two main tools which can do the job of naming or renaming partition labels.
Namely they are
e2label. Both tools are part of
e2fsprogs and are used to solely on
ext2/ext3/ext4 file systems.
Both above mentioned tools will do the job of labeling your partitions or volumes where the only difference
e2label is dedicated solely for partition or volume labeling.
As it was already mentioned these tools will work only on ext2/ext3/ext4 file systems, that is you cannot label disk or partition or
volume which does not have ext2 or ext3 or ext4 file system.
To display a partition label use
# e2label /dev/sda1 #
If you do not see any output produced by
e2label command the label for the partition or volume is not yet set. To set a partition
volume label run:
# e2label /dev/sda1 Boot OR # tune2fs -L Boot /dev/sda1
Both above commands will set partition label of
/dev/sda1 block device to
Boot. Please note that the maximum
label length is 16 bytes that is 16 characters. Let’s check the partition label
# e2label /dev/sda1 Boot
To list label name for all partitions or volumes you may try to use
# blkid /dev/sda5: UUID="f2756986-3749-4bd3-a6e5-f6a867cb4ebb" TYPE="swap" /dev/sda1: UUID="60254c19-67c0-404b-9743-1b8b7f0b11cb" TYPE="ext4" LABEL="Boot"
It is also possible to label your partition during a file system creation. For example you can also set partition label with
command. For example the below command will create a
ext4 filesystem while it will also set a partition label name to
# mkfs.ext4 /dev/sda1 -L ROOT
Please note that tha above command must not be used on existing partitions with a file system as it will destroy your data. Lastly,
you can remove a partition label name by supplying an empty string to either of the above tools:
# e2label /dev/sda1 "" or # tune2fs -L "" /dev/sda1