How to Set Up and Use ZFS on CentOS, Debian, and Fedora

ZFS on CentOS Debian and Fedora

ZFS is a powerful copy on write (COW) file system and volume manager which was originally developed by Sun Microsystems.

It provides features like snapshots, data integrity checking, built-in RAID (RAID-Z), compression and even native encryption.

Due to licensing, ZFS on CentOS, Debian & Fedora (as well as other Linux distributions) is provided via the OpenZFS project.

This means that it must be installed as an extra package rather than coming pre-loaded in the kernel.

In this guide we look at the following:

  • How to install & configure ZFS on CentOS, Debian, & Fedora Systems.
  • We will cover using ZFS for normal data storage, and optionally as a root file system.
  • Compare ZFS’s performance & features with other Linux filesystems.

This post is aimed at intermediate to advanced Linux users who want a complete step by step reference.

Install ZFS on CentOS (RHEL based)

On CentOS/RHEL (including Rocky or AlmaLinux), ZFS is available from the OpenZFS repository. Start by adding the ZFS repo & EPEL, then install the ZFS packages:

  1. Add the ZFS repository: Download & install the latest ZFS release for CentOS/RHEL 8 or 9: dnf install -y https://zfsonlinux.org/epel/zfs-release-$(rpm --eval "%{dist}").noarch.rpm
  2. Enable EPEL & install ZFS: dnf install -y epel-release kernel-devel zfs
  3. Load the ZFS module: modprobe zfs
  4.  Enable ZFS on boot (optional): Create /etc/modules-load.s/zfs.conf with content zfs
After these steps, CentOS will have ZFS support. You can then create ZFS pools which we will explore in subsequent sections.

Installing ZFS On Debian

Debian includes ZFS packages in its contrib repository (backported via Bookworm backports for the latest versions):

    1. Enable contrib/backports:
      Edit /etc/apt/sources.list to include: deb http://deb.debian.org/debian bookworm-backports main contrib (pin as needed).
    2. Update & Install ZFS:
      apt update && apt install dpkg-dev linux-headers-amd64 linux-image-amd64 bookworm-backports zfs-dkms sfsutils-linux
    3. Load ZFS Module: modeprobe zfs

After installation, you can proceed to create ZFS pools on any disks.

Installing ZFS on Fedora

Fedora supports ZFS through the zfsonlinux.org repository.
  1. Remove old zfs-fuse (if any): rpm -e --nodeps zfs-fuse
  2. Add the ZFS repo: dnf install -y https://zfsonlinux.org/fedora/zfs-release-2-8$(rpm --eval "%{dist}").noarch.rpm
  3. Install kernel headers & ZFS: dnf install -y kernel-devel-$(uname -r | cut -d- -f1) dnf install -y zfs
  4. Load module: modprobe zfs
After this, Fedora will have a working ZFS module and can use ZFS pools

Creating ZFS Storage Pools & Filesystems

  1. Initialize disks (optional): Use /dev/disk/by-id/paths for stability.
  2. Create a zpool:For a Mirror: zpool create tank mirror /dev/disk/by-id/diskA /dev/disk/by-id/diskB

    For a stripe:zpool create tank /dev/disk/by-id/diskX

  3. Create ZFS filesystems: zfs create tank/data
    zfs set mountpoint=/tank tank/data

ZFS as a Root Filesystem (Optional)

Installing your OS on ZFS (root /) is possible, but more complex. You’ll need to disable Secure Boot, boot from live media, and follow OpenZFS documentation for partitioning, zpool creation, and bootloader configuration. For most users, ZFS is best used as a data pool alongside a standard root filesystem.

Performance Comparison with Other Filesystems

ZFS is feature rich but uses more resources (RAM/CPU) than ext4 or XFS. Ext4/XFS generally deliver faster raw throughput for sequential workloads, but ZFS excels at data integrity, snapshots, and scalability. With enough memory and modern CPUs, ZFS performance is excellent for most mixed workloads.

Pros and Cons of ZFS

Pros:

  • Data integrity (checksumming, self healing)

  • Snapshots and clones

  • Built-in RAID-Z

  • Volume management

  • Scalability

  • Native encryption

  • Advanced features (deduplication, replication)

Cons:

  • Higher RAM/CPU use

  • Not in kernel (separate install)

  • Licensing complexity

  • Upgrade/portability concerns

  • Learning curve

Troubleshooting Tips

  • Kernel Module Not Loading: Make sure kernel headers match your running kernel and Secure Boot is disabled.

  • Mismatch on Updates: After a kernel update, rebuild the ZFS module if needed.

  • Pool Doesn’t Import: Use zpool import -a and check device paths.

  • Protected Package: Protect ZFS from removal during updates.

  • Module Removal: Don’t mix DKMS and kmod; use one method.

Security Considerations

ZFS ensures data integrity with checksumming and self healing. Native encryption is supported for dataset level security. Always update regularly and use only official OpenZFS repositories.

Conclusion and Call to Action

Setting up ZFS on CentOS, Debian, and Fedora gives you enterprise grade storage features. Try it for your data or root filesystem and compare performance.

Have you used ZFS in production or on the desktop?

Share your experience or ask questions in the comments below!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.