How To: check and change filesystem label with e2label

e2label command for checking ext2/ext3/ext4 filesystem label

Some Linux distros (especially older ones) have preference for using filesystem labels instead of unique identifiers (UUIDs) or device names.

Long time ago there was a post here about using tune2fs for configuring filesystem label, but for ext filesystems (ext2/ext3/ext4) there’s an easier way: use e2label command.

Check ext2/ext3/ext4 Filesystem Label with e2label

Simply run e2label and specify the device name:

root@ubuntu:~ # e2label /dev/sda1

Set Filesystem Label with e2label

If you run the same command and specify the label, it will get assigned to the device:

root@ubuntu:~ # e2label /dev/sda1 rootdisk
root@ubuntu:~ # e2label /dev/sda1
rootdisk

I’ll show how to use filesystem labels in /etc/fstab tomorrow.

See Also