e2label
Set or change a filesystem's label
TLDR
Change the volume label on a specific ext partition
SYNOPSIS
e2label device [newlabel]
PARAMETERS
device
The path to the block device (e.g., /dev/sda1) containing the ext2/3/4 filesystem whose label is to be read or changed.
newlabel
An optional string specifying the new volume label for the filesystem. If this argument is omitted, e2label will display the current label of the device. Labels can be up to 16 characters long.
DESCRIPTION
The e2label command is a utility used to display or change the volume label of an ext2, ext3, or ext4 filesystem.
Filesystem labels provide a human-readable identifier for disk partitions, making them easier to manage and reference compared to less intuitive UUIDs (Universally Unique Identifiers) or ephemeral device names like /dev/sda1.
When invoked without a newlabel argument, e2label prints the current label of the specified filesystem. When a newlabel is provided, the command modifies the filesystem's superblock to store the new label. This change can be particularly useful for configuring /etc/fstab entries, allowing filesystems to be mounted by their descriptive label rather than a potentially changing device path or a long UUID.
It requires root privileges to operate, as it directly modifies critical filesystem metadata.
CAVEATS
The maximum length for a filesystem label is 16 characters.
Only ext2, ext3, and ext4 filesystems are supported.
Running e2label requires root privileges.
If a filesystem's label is changed and that label is used in /etc/fstab for mounting, /etc/fstab must be updated accordingly to ensure correct mounting behavior.
USAGE WITH /ETC/FSTAB
Filesystem labels are often preferred over UUIDs or device paths in /etc/fstab for mounting filesystems. For instance, instead of UUID=xxxxxxxx-xxxx-... or /dev/sda1, one can use LABEL=MyDataDisk. This enhances readability and can make configurations more robust against changes in device paths that might occur after reboots or hardware modifications, as long as the label itself remains consistent.
HISTORY
e2label is a fundamental utility that forms part of the e2fsprogs package, a comprehensive suite of user-space utilities for managing the ext2, ext3, and ext4 filesystems on Linux. Its development has closely paralleled the evolution and adoption of these filesystem types as the standard for Linux systems. As such, it has been a core component for filesystem administration for many years, providing a simple yet powerful way to identify and organize disk partitions.