# e2label

设置第二扩展文件系统的卷标

## 补充说明

**e2label命令** 用来设置第二扩展文件系统的卷标。

### 语法

```
e2label(参数)
```

### 参数

* 文件系统：指定文件系统所对应的设备文件名；
* 新卷标：为文件系统指定新卷标。

### 实例

许多用了多年Linux的人可能也没有用过e2label命令。但是这个命令相当有效。在介绍它之前,我们先看看`/etc/fstab文`件：

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

第二行的意思很容易懂，就是把`/dev/hda7` mount到`/usr`上。第一行没有指明分区，意思是把label(卷标)为/ 的分区mount到/上。这样写的好处在于即使如果把硬盘从主板上的ide0(hda) 换到ide2(hdc)上，系统仍然可以自动挂载正确的分区。通常Linux安装的时候已经自动指定了卷标。如果是手动增加的新分区，可以用下边的命令为 其指定卷标：

```
e2label /dev/hdax /new
mkdir /new
```

然后在`/etc/fstab`里加入：

```
label=/new  /new  ext3  defaults  1 1
```

下次重新起动机器的时候，就会把卷标为`/new`的分区挂接到`/new`上。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hezhiqiang.gitbook.io/linux/ming-ling/e2label.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
