> 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/shou-ce-ye/xi-tong-guan-li-ming-ling-system-administration-8/zfs-rollback.8.md).

# zfs-rollback(8)

## 名称

`zfs-rollback` — 将 ZFS 数据集回退到快照

## 概述

```sh
zfs rollback [-Rfr] 快照
```

## 说明

数据集回退时，自快照创建以来变更的所有数据都会被丢弃，数据集恢复到该快照所记录的状态。默认情况下，该命令拒绝回退到除最近一个快照以外的快照。若要回退到更早的快照，必须通过指定 `-r` 选项销毁所有中间的快照与书签。

`-r` 与 `-R` 选项不会递归销毁递归快照的子快照。这两个选项只会销毁指定文件系统的直接快照。要完全回退一个递归快照，你必须逐个回退其子快照。

### `-R`

销毁所有比目标快照更新的快照与书签，以及这些快照的所有克隆。

### `-f`

与 `-R` 选项配合使用，强制卸载任何将被销毁的克隆文件系统。

### `-r`

销毁所有比指定快照更新的快照与书签。

## 示例

### 示例 1：回退 ZFS 文件系统

以下命令将 `pool/home/anne` 的内容回退到名为 `yesterday` 的快照，并删除所有中间快照：

```sh
# zfs rollback -r pool/home/anne@yesterday
```

## 参考文献

zfs-snapshot(8)

2025 年 4 月 28 日


---

# 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/shou-ce-ye/xi-tong-guan-li-ming-ling-system-administration-8/zfs-rollback.8.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.
