To change the label (name) of a disk on an EXT2, EXT3, or EXT4 file system in Linux, you can use the e2label
command.
The e2label
command is a utility that allows you to view or change the label of an EXT2, EXT3, or EXT4 file system. The label is a user-defined string that is used to identify the disk or partition.
To change the label of a disk or partition using the e2label
command, you will need to specify the device file for the disk or partition and the new label as arguments.
For example, to change the label of the /dev/sda1
partition to mylabel
, you can use the following command:
$ e2label /dev/sda1 mylabel
This will change the label of the /dev/sda1
partition to mylabel
.
To view the current label of a disk or partition, you can use the e2label
command without specifying a new label.
For example, to view the label of the /dev/sda1
partition, you can use the following command:
$ e2label /dev/sda1
This will output the current label of the /dev/sda1
partition.
Note that you will need to be the superuser (root user) or have the necessary permissions to use the e2label
command. If you do not have the necessary permissions, you may receive an error message.
It is also important to note that the label of a disk or partition is not the same as the mount point or the name of the directory where the disk or partition is mounted. To change the mount point or the name of the directory, you can use the mount
command or edit the /etc/fstab
file.