e2label

e2label

The e2label command in Linux is used to set or display the label of an ext2, ext3, or ext4 filesystem. The label is a name that is assigned to a filesystem and can be used to identify it.

The e2label command is used in the following syntax:

e2label [options] device label

The device is the path to the device that contains the filesystem that you want to label.

The label is the new label for the filesystem.

The options can be used to specify the following:

  • -f : Force overwriting the existing label.

  • -n : Do not actually change the label, just print the new value.

For example, the following code will set the label of the ext4 filesystem on device /dev/sda1 to my_data:

e2label /dev/sda1 my_data

This code will set the label of the ext4 filesystem on device /dev/sda1 to my_data.

The following code will print the label of the ext4 filesystem on device /dev/sda1 without actually changing it:

e2label -n /dev/sda1

This code will print the label of the ext4 filesystem on device /dev/sda1 without actually changing it.

The e2label command is a simple and useful command that can be used to set or display the label of an ext2, ext3, or ext4 filesystem. It is a valuable command to know, especially if you need to identify or manage filesystems.

help

Last updated