> 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/an-zhuang-zhi-yin/debian/index.md).

# 在 Debian 中启用 ZFS 支持

## 安装

如果你想将 ZFS 用作根文件系统，请改为参阅[以 ZFS 为根文件系统](https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/index.html#root-on-zfs)的相关页面。

ZFS 软件包包含在 [contrib 仓库](https://packages.debian.org/source/zfs-linux) 中。[backports 仓库](https://backports.debian.org/Instructions/) 通常提供更新版本的 ZFS。你可以按如下方式使用。

添加 backports 仓库：

```sh
vi /etc/apt/sources.list.d/trixie-backports.list
```

```ini
deb http://deb.debian.org/debian trixie-backports main contrib non-free-firmware
deb-src http://deb.debian.org/debian trixie-backports main contrib non-free-firmware
```

```sh
vi /etc/apt/preferences.d/90_zfs
```

```ini
Package: src:zfs-linux
Pin: release n=trixie-backports
Pin-Priority: 990
```

安装软件包：

```sh
apt update
apt install dpkg-dev linux-headers-generic linux-image-generic
apt install zfs-dkms zfsutils-linux
```

> **注意**
>
> 如果你处于配置不良的环境中（例如某些虚拟机或容器控制台），当 apt 在首次安装时尝试弹出提示信息，它可能未能察觉实际上并没有真正可用的控制台，于是表现为无限期停滞。为避免这种情况发生，你可以在 `apt install` 命令前加上 `DEBIAN_FRONTEND=noninteractive`，形如：
>
> ```sh
> DEBIAN_FRONTEND=noninteractive apt install zfs-dkms zfsutils-linux
> ```


---

# 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/an-zhuang-zhi-yin/debian/index.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.
