> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/zfs/xiang-mu-yu-she-qu/faq-hole-birth.md).

# FAQ：hole birth 缺陷

## 简要解释

hole\_birth 特性存在（或曾存在）缺陷：如果从受影响的数据集执行 `zfs send -i`（或 `-R`，因为它内部使用 `-i`），接收端不会看到任何校验和或其他错误，但生成的目标快照将与源不一致。

ZoL 0.6.5.8 与 0.7.0-rc1（及更高）版本默认在 **发送端** 忽略导致此问题的损坏元数据。

## 常见问题

### 我的存储池启用了 hole\_birth，如何判断自己是否受影响？

理论上可以计算是否存在受影响的文件，但需要抓取每个数据集中每个快照里每个文件的 `zdb` 输出，组合复杂度高得难以承受。（如果你确实想试，可以在[此处](https://github.com/rincebrain/hole_birth_test)找到一个概念验证。）

### 如果已经接收了受影响的快照，有没有不那么痛苦的修复方式？

没有。所需的数据根本没有包含在发送流中，因此无法切实地原地重写。

## 详细解释

hole\_birth 是一项用于加速 `zfs send -i` 的特性。具体而言，ZFS 过去不存储文件中“空洞”（稀疏区域）创建时间的元数据，因此每次 `zfs send -i` 都要包含所有空洞。

顾名思义，hole\_birth 增加了对空洞创建时所在事务组（txg）的跟踪，使 `zfs send -i` 只需发送出生时间介于（起始快照 txg）与（结束快照 txg）之间的空洞，于是皆大欢喜。

不幸的是，hole\_birth 在某些边缘情况下会“忘记”设置空洞的出生时间，从而将其记录为 0（这是 hole\_birth 之前使用的值，本质上等同于“自文件创建以来”）。

这意味着，当你执行 `zfs send -i` 时，由于 `zfs send` 在发送给定快照时并不知晓周围的快照，它会把创建 txg 视为 0，并据此判断“它是 0，我之前肯定已经发送过它了”，于是不发送该空洞。

这样一来，接收端并不知道这些空洞应当存在，也就不会创建它们。这就会导致源与目标之间出现差异。

ZoL 0.6.5.8 与 0.7.0-rc1（及更高）版本默认忽略该元数据，并始终发送出生时间为 0 的空洞；可通过名为 `ignore_hole_birth` 或 `send_holes_without_birth_time` 的可调参数进行配置，OpenZFS 最终采用后者。ZoL 0.6.5.8 仅提供前者，但对于任何带有 `send_holes_without_birth_time` 的 ZoL 版本，二者指向同一个值，因此修改任意一个都有效。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://book.bsdcn.org/zfs/xiang-mu-yu-she-qu/faq-hole-birth.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
