The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
 




The e2label command in Linux is used to assign or change the label of an ext2, ext3, or ext4 filesystem. The label is a user-friendly name that can be associated with a filesystem, making it easier to identify and manage partitions. The label is usually a short, descriptive text that provides information about the content or purpose of the filesystem.

The basic syntax of the e2label command is as follows:
e2label [OPTIONS] DEVICE [NEW_LABEL] .


Here,"OPTIONS"are optional flags that modify the behavior of the e2label command, device is the block device (partition) where the filesystem is located, and "NEW_LABEL" is the new label you want to assign.

Common options for the e2label command include:

Here are a few examples of using the e2label command:
e2label /dev/sdb1 mydata ←Assign a label to a filesystem
# e2label /dev/sdc1 newlabel ←Change the label of an existing filesystem
# e2label -E /dev/sdd1 ←Clear the label of a filesystem


The e2label command is especially useful when you want to provide meaningful names to your filesystems, making them easier to recognize and manage. It's important to note that changing the label does not affect the contents or functionality of the filesystem; it only updates the associated label metadata


For more information on e2label operations and examples, please refer to the provided link.