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

# zfs-clone(8)

## 名称

`zfs-clone` — 克隆 ZFS 数据集的快照

## 概述

```sh
zfs clone [-pu] [-o 属性=值]… 快照 文件系统|卷
```

## 说明

有关详情，参见 zfsconcepts(7) 的 Clones 一节。目标数据集可以位于 ZFS 层次结构中的任意位置，并以与原始数据集相同的类型创建。

### `-o property=value`

设置指定的属性；详情参见 `zfs create`。

### `-p`

创建所有不存在的父数据集。以此方式创建的数据集会按照从其父级继承的 `mountpoint` 属性自动挂载。如果多次指定 `-p` 选项，父数据集会以 `canmount=off` 创建。如果目标文件系统或卷已经存在，操作会成功完成。

### `-u`

不挂载新创建的文件系统。

## 示例

### 示例 1：创建 ZFS 克隆

以下命令创建一个可写文件系统，其初始内容与 `pool/home/bob@yesterday` 相同。

```sh
# zfs clone pool/home/bob@yesterday pool/clone
```

### 示例 2：提升 ZFS 克隆

以下命令演示如何使用克隆、克隆提升与重命名来测试对文件系统的更改，再用更改后的文件系统替换原始文件系统：

```sh
# zfs create pool/project/production
  向 /pool/project/production 填充数据
# zfs snapshot pool/project/production@today
# zfs clone pool/project/production@today pool/project/beta
  修改 /pool/project/beta 并进行测试
# zfs promote pool/project/beta
# zfs rename pool/project/production pool/project/legacy
# zfs rename pool/project/beta pool/project/production
  旧版本不再需要时即可销毁
# zfs destroy pool/project/legacy
```

## 参考文献

zfs-promote(8)、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-clone.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.
