Chapter 30. ZFS Storage Administration

ZFS combines a volume manager and a filesystem in one implementation. A pool groups block devices into virtual devices (vdevs), and the datasets inside the pool share its free space while carrying their own properties, snapshots, quotas, and encryption keys. Every block is checksummed, every write is copy-on-write, and snapshots are cheap because unchanged blocks are shared rather than duplicated. Those properties make ZFS attractive for file servers, virtual-machine storage, and large data volumes where bit rot, accidental deletion, and storage growth are routine concerns.

Debian packages OpenZFS in the contrib archive component because Debian considers the CDDL license of OpenZFS and the GPLv2 of the Linux kernel incompatible for distributing a combined binary such as a prebuilt kernel module. The module is therefore shipped as DKMS source and built locally against the installed Debian kernel headers, so kernel updates and Secure Boot signing are part of routine administration rather than one-time installation details. This chapter follows a two-host deployment:

Role Host Management address Storage in the example
Primary ZFS host zfs1 192.168.121.9/24 tank mirror on /dev/vdb and /dev/vdc; raidpool RAIDZ1 on /dev/vdd, /dev/vde, and /dev/vdg; /dev/vdf held unused as the replacement disk
Replication target zfs2 192.168.121.227/24 backup pool on /dev/vdb

Both hosts run Debian 13.5 with Linux 6.12.118+deb13-amd64 and OpenZFS 2.3.9-0+deb13u1 from trixie/contrib. They are virtual machines with small disposable virtio disks, so the examples choose bounded layouts that fit the small disks. Production pools usually use larger devices, persistent /dev/disk/by-id/ paths, and more redundancy. Addresses, disk names, and pool names are local examples; substitute your own and keep the same roles.

Two-host ZFS practice topology

Figure 30.1. Conceptual topology of the two practice hosts. zfs1 owns the primary pools and the unused replacement disk; zfs2 receives snapshot streams over SSH. The management network carries both administrative access and replication traffic so that the data path does not depend on a second, fragile network.

Commands entered in john's ordinary shell begin with $; commands entered in a root shell begin with #. The prompt marker is not typed. A single elevated command from john's shell is written $ sudo command. The examples use a root shell for storage administration because most zpool and zfs operations need it; enter that shell with sudo -i and leave it with exit. The practice john account has passwordless sudo to keep the examples short. A password prompt is the normal case on a production host, and the same commands work when sudo asks for one.

The examples keep downloads, streams, keys, and practice files under /home/john/debian-handbook/zfs. Create that workspace and change into it before using relative filenames:

$ mkdir -p ~/debian-handbook/zfs
$ cd ~/debian-handbook/zfs

Neither command prints anything when it succeeds. The directory is owned by john, but root's ~ is a different home directory, so privileged commands that must write there spell out the full path. The examples were recorded on the two hosts above; package versions, device names, capacity figures, timestamps, pool IDs, and stream sizes on other systems will differ.

In this section