How to Run Native ZFS on Linux in Debian

Running the ZFS filesystem natively on Debian requires enabling specific package repositories, installing the Linux kernel headers, compiling the OpenZFS kernel modules via Dynamic Kernel Module Support (DKMS), and ensuring adequate hardware resources. Because the CDDL license used by OpenZFS is legally incompatible with Debian's GPL-licensed Linux kernel binaries, Debian does not ship pre-compiled ZFS kernel modules in its main repositories. This guide outlines the system prerequisites, software dependencies, and fundamental setup needed to successfully run OpenZFS natively on Debian.

Hardware Requirements

To run ZFS reliably, your system should meet the following minimum hardware standards:

  • Architecture: A 64-bit CPU architecture (x86_64/amd64 or arm64). ZFS is not recommended on 32-bit platforms due to address space limitations.
  • Memory (RAM): A minimum of 2 GB of RAM for basic operations. For production environments, 8 GB or more is recommended. ZFS heavily utilizes RAM for its Adaptive Replacement Cache (ARC). If features like deduplication are enabled, ZFS generally requires 1 GB to 5 GB of RAM per terabyte of stored data.
  • Storage Devices: Dedicated, unformatted block devices (HDDs, NVMe drives, or SSDs). Hardware RAID controllers should be set to IT mode (HBA) or JBOD mode, as ZFS directly manages disk redundancy, error detection, and parity.

Software and Repository Prerequisites

Because Debian cannot distribute binary kernel modules of ZFS, you must compile the module locally on your system using DKMS. This requires access to the contrib and non-free repository archives.

  1. Enable Repositories: Update /etc/apt/sources.list to include the contrib and non-free sections alongside main.
  2. Update Package Cache: Run apt update to fetch the updated lists of packages from the newly enabled sections.

Required System Packages

Running native ZFS requires specific compilation tools and userspace management utilities:

  • Kernel Headers: The headers matching your currently running kernel version (linux-headers-$(uname -r)) are necessary to compile the DKMS module against the Debian kernel.
  • zfs-dkms: The source package for OpenZFS that DKMS uses to automatically build and rebuild the ZFS kernel modules whenever your kernel is updated.
  • zfsutils-linux: The userspace administration tools required to create, manage, and monitor ZFS pools (zpool) and filesystems (zfs).

These packages can be installed by running:

apt install linux-headers-$(uname -r) zfs-dkms zfsutils-linux

During this installation, DKMS will automatically trigger a build process to compile the zfs.ko module for your active kernel.

Kernel Module Activation

Once compilation completes, the module must be loaded into the active Linux kernel:

modprobe zfs

To verify that the module is correctly loaded and operational, run:

zfs --version

If the command returns both the userspace version and the kernel module version, the Debian system meets all requirements and is fully prepared to create and manage native ZFS storage pools.