e2label

Set the volume label of the second extended file system

Supplementary instructions

e2label command is used to set the volume label of the second extended file system.

grammar

e2label(parameter)

Parameters

Example

Many people who have used Linux for many years may not have used the e2label command. But this command is quite effective. Before introducing it, let's take a look at the /etc/fstab file:

label=//ext3 defaults 1 1
/dev/hda7 /usr ext3 defaults 1 1

The meaning of the second line is easy to understand, which is to mount /dev/hda7 to /usr. The first line does not specify the partition, which means to mount the partition with label (volume label) / to /. The advantage of writing this way is that even if the hard disk is changed from ide0 (hda) on the motherboard to ide2 (hdc), the system can still automatically mount the correct partition. Usually the volume label is automatically assigned during Linux installation. If the new partition is added manually, you can use the following command to specify a volume label for it:

e2label /dev/hdax /new
mkdir /new

Then add: in /etc/fstab:

label=/new /new ext3 defaults 1 1

The next time the machine is restarted, the partition with the volume label /new will be attached to /new.