# 消息 ID：ZFS-8000-8A

## 数据损坏（Corrupted data）

|  类型  | 错误               |
| :--: | ---------------- |
|  严重性 | 紧急               |
|  描述  | 由于数据损坏，无法读取文件或目录 |
| 自动响应 | 不会采取自动响应         |
|  影响  | 文件或目录不可用         |

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

运行 `zpool status -x` 确定哪个池发生了损坏：

```sh
# zpool status -x
  pool: test
 state: ONLINE
status: One or more devices has experienced an error and no valid replicas
        are available.  Some filesystem data is corrupt, and applications
        may have been affected.
action: Destroy the pool and restore from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
 scrub: none requested
config:

        NAME                  STATE     READ WRITE CKSUM
        test                  ONLINE       0     0     2
          c0t0d0              ONLINE       0     0     2
          c0t0d1              ONLINE       0     0     0

errors: 1 data errors, use '-v' for a list
```

不幸的是，无法修复数据，而修复数据的唯一选择是从备份恢复池。尝试访问损坏数据的应用程序将收到错误（EIO），并且数据可能会永久丢失。

可以通过对 `zpool status` 使用选项 `-v` 来获取受影响文件的列表：

```sh
# zpool status -xv
  pool: test
 state: ONLINE
status: One or more devices has experienced an error and no valid replicas
        are available.  Some filesystem data is corrupt, and applications
        may have been affected.
action: Destroy the pool and restore from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
 scrub: none requested
config:

        NAME                  STATE     READ WRITE CKSUM
        test                  ONLINE       0     0     2
          c0t0d0              ONLINE       0     0     2
          c0t0d1              ONLINE       0     0     0

errors: Permanent errors have been detected in the following files:

        /export/example/foo
```

能否删除损坏的文件取决于损坏的类型。如果损坏发生在普通数据中，则文件应当可以被删除。如果损坏发生在文件元数据中，则文件无法被删除，不过可以移动到其他位置。上述两种情况，都应当从备份源恢复数据。损坏也可能分布在整个池范围的元数据中，从而造成整个数据集不可用。如果发生这种情况，唯一的选择是销毁池，然后再从备份重新创建数据集。

## 详细信息

消息 ID：`ZFS-8000-8A` 表示当前池中存在损坏的数据。


---

# 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://book.bsdcn.org/zfs/zfs-xiao-xi/zfs-8000-8a.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.
