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

# zfs-share(8)

## 名称

`zfs-share` — 共享与取消共享 ZFS 文件系统

## 概述

```sh
zfs share [-l] -a | 文件系统
```

```sh
zfs unshare -a | 文件系统 | 挂载点
```

## 说明

### `zfs share [-l] -a | filesystem`

共享可用的 ZFS 文件系统。

#### `-l`

在挂载加密文件系统的过程中加载其密钥。这等同于在挂载前对每个加密根执行 `zfs load-key`。注意，如果某个文件系统的 `keylocation` 为 `prompt`，这会使终端在索取密钥后交互式阻塞。

#### `-a`

共享所有可用的 ZFS 文件系统。作为引导过程的一部分自动调用。

#### `filesystem`

按照 `sharenfs` 与 `sharesmb` 属性共享指定的文件系统。设置了 `sharenfs` 或 `sharesmb` 属性时，文件系统即被共享。

### `zfs unshare -a | filesystem | mountpoint`

取消共享当前已共享的 ZFS 文件系统。

#### `-a`

取消共享所有可用的 ZFS 文件系统。作为关机过程的一部分自动调用。

#### `filesystem | mountpoint`

取消共享指定的文件系统。该命令也可以接受系统中某个已共享 ZFS 文件系统的路径。

## 参考文献

exports(5)、smb.conf(5)、zfsprops(7)

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-share.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.
