How to change filesystem label with tune2fs

Some properties of ext2, ext3, and ext4 file systems on Linux and UNIX can be tuned on the fly using the tune2fs command. This includes the file system’s label.

First of all let’s list the existing values of a given file system using the -l option:

$ tune2fs -l /dev/sda1

You can also use dump2fs /dev/sda1 to list a lot more of the information about the file system, but the above command will neatly list all of the tunable values including the “Filesystem volume name”, which is the file system label.

To change the label use the -L or –volume-label option followed by the new desired label. Keep in mind ext2 file system labels can be only 16 characters long, and will otherwise be truncated.

$ tune2fs -L /dev/sda1 MyFilesystem

Of course, replace “MyFilesystem” with your own desired label and /dev/sda1 with your own device. After you set the label you can specify this file system by its label when using programs like fsck and mount or in the /etc/fstab configuration file by using LABEL=MyFilesystem.

See Also




Keep Learning

Follow me on Facebook, Twitter or Telegram:
Recommended
I learn with Educative: Educative
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!

Recent Tweets