e2label: change ext2/ext3/ext4 filesystem label
SYNOPSIS
e2label [device] [new-label]DESCRIPTION
e2label displays or modifies the volume label on an ext2, ext3, or ext4 filesystem. Without a label argument, it prints the current label. With a label argument, it writes the new label to the filesystem superblock. Labels are limited to 16 characters; longer strings are truncated. Labels assigned with e2label can be referenced in /etc/fstab using LABEL= syntax for persistent mount configuration.
- If the optional
new-labelargument is omitted,e2labeldisplays the current filesystem volume label. - If
new-labelis specified,e2labelwrites the new volume label to the filesystem superblock. - Ext2/3/4 filesystem volume labels are limited to a maximum of 16 characters. Longer strings are truncated with a warning message.
EXAMPLES
# 1. View the current label of a partition
sudo e2label /dev/nvme0n1p2
# 2. Assign a new label to an Ext4 partition
sudo e2label /dev/nvme0n1p2 "LINUX_ROOT"
# 3. Modify label using tune2fs
sudo tune2fs -L "BACKUP_POOL" /dev/sdb1
# 4. Verify the label using blkid and lsblk
sudo blkid /dev/nvme0n1p2
lsblk -o NAME,LABEL,UUID,FSTYPEThe tune2fs command shown above also handles filesystem repair and recovery. See the filesystem repair guide for its use in fixing corrupted ext4 volumes.
CROSS-FILESYSTEM LABELING UTILITIES
| Filesystem | Label Command | Query Command |
|---|---|---|
| Ext2 / Ext3 / Ext4 | sudo e2label /dev/sdX1 "LABEL" | sudo e2label /dev/sdX1 |
| XFS | sudo xfs_admin -L "LABEL" /dev/sdX1 | sudo xfs_admin -l /dev/sdX1 |
| Btrfs | sudo btrfs filesystem label /mountpoint "LABEL" | sudo btrfs filesystem label /mountpoint |
| FAT16 / FAT32 (ESP) | sudo fatlabel /dev/sdX1 "LABEL" | sudo fatlabel /dev/sdX1 |
| exFAT | sudo exfatlabel /dev/sdX1 "LABEL" | sudo exfatlabel /dev/sdX1 |
Sources & references
- e2label(8) — Linux manual page — primary source documenting e2label command syntax, behavior for displaying vs setting labels, and the 16-character limit
- tune2fs(8) — Linux manual page — documents tune2fs -L option as an alternative method for setting ext2/3/4 volume labels
- xfs_admin(8) — Linux manual page — documents xfs_admin for XFS label management with -L to set and -l to query labels
- fatlabel(8) — Linux manual page — documents fatlabel for FAT16/FAT32/ESP labeling with 11-character limit
- blkid(8) — Linux manual page — documents blkid for verifying filesystem labels and UUIDs after setting them with e2label or other tools
Frequently asked questions
What does e2label do?
e2label displays or modifies the volume label on an ext2, ext3, or ext4 filesystem. Without a new-label argument it displays the current label. With one, it writes the label to the filesystem superblock.
What is the maximum length of an ext4 filesystem label?
Ext2/3/4 filesystem volume labels are limited to 16 characters. Longer strings are truncated with a warning message.
How do I view the current label of an Ext4 partition?
Run sudo e2label /dev/nvme0n1p2 without a label argument. You can also verify with sudo blkid /dev/nvme0n1p2 or lsblk -o NAME,LABEL,UUID,FSTYPE.
How do I change an ext4 label using tune2fs?
Use sudo tune2fs -L "BACKUP_POOL" /dev/sdb1 as an alternative to e2label. Both commands write the label to the filesystem superblock.
How do I label an XFS filesystem?
Use sudo xfs_admin -L "LABEL" /dev/sdX1 to set the label and sudo xfs_admin -l /dev/sdX1 to query it. XFS labels are limited to 12 characters.
How do I label a FAT32 EFI System Partition?
Use sudo fatlabel /dev/sdX1 "LABEL". FAT labels are limited to 11 characters. For exFAT, use sudo exfatlabel /dev/sdX1 "LABEL" instead.