File system labels are assigned to file systems for easy identification. The labels may be up to 16 characters long and can be displayed or changed using the e2label command for ext# file systems and the xfs_admin command for XFS file systems.
Syntax
The syntax for setting ext# file system labels is:
# e2label /dev/{device name}{partition number} {label name}
The syntax for setting XFS file system labels is:
# xfs_admin -L {label name} /dev/{device name}{partition number}
If you encounter the below error while running the e2label command:
e2label: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
OS X | brew install e2fsprogs |
Debian | apt-get install e2fsprogs |
Ubuntu | apt-get install e2fsprogs |
Alpine | apk add e2fsprogs |
Arch Linux | pacman -S e2fsprogs |
Kali Linux | apt-get install e2fsprogs |
CentOS | yum install e2fsprogs |
Fedora | dnf install e2fsprogs |
Raspbian | apt-get install e2fsprogs |
e2label Command Example
1. Change the volume label on a specific ext partition:
# e2label /dev/sda1 "label_name"