# 消息 ID：ZFS-8000-4J

## 复制配置中设备标签损坏

|  类型  | 错误                   |
| :--: | -------------------- |
|  严重性 | 重要                   |
|  描述  | 由于设备标签缺失或无效，某个设备无法打开 |
| 自动响应 | 如果可用，将激活热备用          |
|  影响  | 存储池不再提供配置的复制级别       |

## 建议系统管理员采取的操作

### 对于活动池

如果在运行 `zpool import` 时遇到此错误，请参见下文。否则请运行 `zpool status -x` 来确定哪个池出现了故障：

```sh
# zpool status -x
  pool: test
 state: DEGRADED
status: One or more devices could not be used because the label is missing or
        invalid.  Sufficient replicas exist for the pool to continue
        functioning in a degraded state.
action: Replace the device using 'zpool replace'.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-4J
 scrub: none requested
config:

        NAME                  STATE     READ WRITE CKSUM
        test                  DEGRADED     0     0     0
          mirror              DEGRADED     0     0     0
            c0t0d0            ONLINE       0     0     0
            c0t0d1            FAULTED      0     0     0  corrupted data

errors: No known data errors
```

如果设备被临时从系统分离，请将设备重新附加到系统然后再次运行 `zpool status`。存储池应自动检测新附加的设备并恢复运行。

如果设备不再可用，可使用 `zpool replace` 命令替换设备：

```sh
# zpool replace test c0t0d1 c0t0d2
```

如果设备已被同一物理插槽中的另一块磁盘替换，则可以使用 `zpool replace` 命令的单参数形式进行替换：

```sh
# zpool replace test c0t0d1
```

发出替换命令后，ZFS 将开始将数据迁移到新设备。resilver 完成后，原设备（如果与替换设备不同）将被移除，存储池将恢复到 ONLINE 状态。

### 对于已导出的池

如果在运行 `zpool import` 时遇到此错误，即使出现故障，仍可导入池：

```sh
# zpool import
  pool: test
    id: 5187963178597328409
 state: DEGRADED
status: One or more devices contains corrupted data.  The fault tolerance of
        the pool may be compromised if imported.
action: The pool can be imported using its name or numeric identifier.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-4J
config:

        test              DEGRADED
          mirror          DEGRADED
            c0t0d0        ONLINE
            c0t0d1        FAULTED   corrupted data
```

要导入池请运行：

```sh
# zpool import test
```

池导入后，可按上述操作替换损坏设备。

## 详细信息

消息 ID：`ZFS-8000-4J` 表示 ZFS 子系统无法打开某个设备。
