> 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-diff.8.md).

# zfs-diff(8)

## 名称

`zfs-diff` — 显示两个 ZFS 快照之间的差异

## 概述

```sh
zfs diff [-FHth] 快照 快照 | 文件系统
```

## 说明

显示给定文件系统的某个快照与该文件系统之后某个快照（或文件系统当前内容）之间的差异。第一列是一个指示变更类型的字符，其余各列分别指示路径名、新路径名（重命名时）、链接计数变化，以及可选的文件类型和/或变更时间。变更类型如下：

### `-`

该路径已被移除

### `+`

该路径已被创建

### `M`

该路径已被修改

### `R`

该路径已被重命名

### `-F`

以与 ls(1) 的 `-F` 选项相似的方式显示文件类型指示。

* `B`：块设备
* `C`：字符设备
* `/`：目录
* `>`：门
* `|`：命名管道
* `@`：符号链接
* `P`：事件端口
* `=`：套接字
* `F`：常规文件

### `-H`

提供更具可解析性的制表符分隔输出，不带标题行，也不带箭头。

### `-t`

在输出的第一列显示该路径的 inode 变更时间。

### `-h`

不对非 ASCII 路径进行 `\0ooo` 转义。

## 示例

### 示例 1：显示快照与 ZFS 数据集之间的差异

以下示例展示了如何查看 ZFS 数据集的先前快照与其当前状态之间发生了哪些变化。使用 `-F` 选项显示受影响文件的类型信息。

```sh
# zfs diff -F tank/test@before tank/test
M       /       /tank/test/
M       F       /tank/test/linked      (+1)
R       F       /tank/test/oldname -> /tank/test/newname
-       F       /tank/test/deleted
+       F       /tank/test/created
M       F       /tank/test/modified
```

## 参考文献

zfs-snapshot(8)

2022 年 7 月 11 日


---

# 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-diff.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.
