> 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/ask/flat/chapter-28-the-zfs-file-system/di-28.8-jie-geng-xin-openzfs.md).

# 28.8 Updating OpenZFS

When implementing coexistence of multiple FreeBSD versions, an important consideration is ZFS pool version compatibility. Typically, ZFS pool versions and features change between FreeBSD major versions; for example, zpool usually changes during major version updates, which may prevent mutual access to storage pools.

Coexistence of multiple system versions such as 13, 14, and 15 can be achieved through the OpenZFS implementation in Ports.

## Viewing the Built-in OpenZFS Version

First, check the current system's built-in ZFS version information to confirm the version to be replaced.

Display the current ZFS tool and kernel module version information:

```sh
# zfs version
zfs-2.2.7-FreeBSD_ge269af1b3
zfs-kmod-2.2.7-FreeBSD_ge269af1b3
```

The current FreeBSD base system includes OpenZFS 2.2.7 (i.e., from <https://github.com/openzfs/zfs/commit/e269af1b3>).

## Installing filesystems/openzfs

The OpenZFS in Ports provides more flexible version choices than the base system. It can be installed using either pkg or Ports.

* Install using pkg

```sh
# pkg install openzfs
```

* Install using Ports:

```sh
# cd /usr/ports/filesystems/openzfs/
# make install clean
```

## Editing the **/boot/loader.conf** File

After installation, you need to configure which ZFS module the system loads at startup. By default, the system loads the ZFS module built into the base system; this behavior needs to be modified.

To prevent the system from loading the base system's built-in ZFS version, add a comment `#` before `zfs_load=YES` to disable its automatic loading at boot.

For example:

```ini
# zfs_load=YES 	# Do not load the built-in ZFS kernel module
```

Then add the following lines:

```ini
zfs_load=NO        # Explicitly disable built-in ZFS kernel module loading
openzfs_load=YES   # Enable OpenZFS module loading
```

Restart the system after completion.

## Checking the ZFS Version

After configuration and restart, you need to verify that the system has correctly loaded the Ports version of OpenZFS.

After restarting, check the ZFS version:

```sh
# zfs version
zfs-2.2.7-FreeBSD_ge269af1b3
zfs-kmod-2.3.5-1
```

You can then update other storage pools or enable new features.

> **Warning**
>
> Considering that the OpenZFS version in the base system may not be the latest, it is recommended to use OpenZFS from Ports for all versions to maintain version consistency, including 15.0-RELEASE, which should also replace ZFS using the same method.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.bsdcn.org/ask/flat/chapter-28-the-zfs-file-system/di-28.8-jie-geng-xin-openzfs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
