How to Set Up ZFS on RHEL 7

ZFS (Zettabyte File System) originated at Sun Microsystems and is widely regarded as the most feature-rich and reliable open-source file system available. It combines volume management, RAID, checksumming, copy-on-write snapshots, deduplication, and transparent compression into a single unified stack. The ZFS on Linux (ZoL) project brings these capabilities to the Linux kernel as a DKMS or kABI-tracking kernel module, and RHEL 7 is a supported platform. This tutorial covers adding the ZFS on Linux repository, installing the required packages, creating pools and datasets, managing properties, taking snapshots, and replicating data between servers using zfs send and zfs receive.

Prerequisites

  • RHEL 7 system with root access
  • EPEL repository enabled (yum install epel-release)
  • At least two unused block devices for a mirrored pool (e.g., /dev/sdb, /dev/sdc)
  • Internet access to reach the ZFS on Linux repository
  • Kernel headers matching the running kernel (kernel-devel)

Step 1: Add the ZFS on Linux Repository

The official ZFS on Linux packages are hosted at zfsonlinux.org. The project provides a repository RPM that configures the correct yum repo for your distribution. Download and install the release package for RHEL 7.

# Install the ZFS on Linux repository for RHEL 7
yum install -y http://download.zfsonlinux.org/epel/zfs-release.el7_9.noarch.rpm

# Verify the repository was added
yum repolist | grep zfs

By default, the repository is configured to deliver the kABI-tracking kmod packages, which are pre-built against known RHEL 7 kernel ABIs and require no local compilation. If you are running a custom kernel, switch to the dkms variant instead by editing /etc/yum.repos.d/zfs.repo and toggling the enabled flags.

Step 2: Install ZFS

# Install the kmod ZFS package (pre-built kernel module)
yum install -y zfs

# If the kmod variant is unavailable for your kernel, use DKMS:
# yum install -y kernel-devel zfs-dkms

# Check what was installed
rpm -qa | grep zfs

The installation places the ZFS kernel module files under /lib/modules/$(uname -r)/extra/zfs/ and installs the zpool, zfs, zdb, and zstream utilities.

Step 3: Load the ZFS Kernel Module

After installation the ZFS module must be loaded into the running kernel. You can load it manually with modprobe, and configure it to load automatically at boot via /etc/modules-load.d/.

# Load ZFS module into the running kernel
modprobe zfs

# Verify the module loaded without errors
lsmod | grep zfs

# Configure automatic loading at boot
echo "zfs" > /etc/modules-load.d/zfs.conf

# Enable the ZFS mount and import services
systemctl enable zfs-import-cache
systemctl enable zfs-import-scan
systemctl enable zfs-mount
systemctl enable zfs.target

Step 4: Create a ZFS Pool

A ZFS pool (zpool) is the top-level storage container. Pools are created over one or more block devices and support several RAID-like configurations called vdev types.

Mirror Pool (RAID-1 equivalent)

# Create a mirrored pool named 'datapool' across /dev/sdb and /dev/sdc
zpool create datapool mirror /dev/sdb /dev/sdc

# List all pools and their status
zpool list

RAIDZ1 Pool (RAID-5 equivalent — single parity)

# RAIDZ1 requires at least 3 devices; tolerates 1 disk failure
zpool create datapool raidz /dev/sdb /dev/sdc /dev/sdd

RAIDZ2 Pool (RAID-6 equivalent — double parity)

# RAIDZ2 requires at least 4 devices; tolerates 2 disk failures
zpool create datapool raidz2 /dev/sdb /dev/sdc /dev/sdd /dev/sde

ZFS pools are automatically mounted at /datapool (the pool name) by default. You can customise the mount point during creation with the -m flag.

Step 5: Create and Manage ZFS Datasets

Within a pool you create datasets (file systems) or zvols (block volumes). Datasets inherit properties from their parent and can have individual settings overridden.

# Create a dataset for web data
zfs create datapool/www

# Create a nested dataset
zfs create datapool/www/logs

# List all datasets in the pool
zfs list

# Show all properties of a dataset
zfs get all datapool/www

Step 6: Set ZFS Dataset Properties

ZFS properties control compression, deduplication, quotas, reservations, mount points, and dozens of other behaviors. Properties set on a parent dataset are inherited by all children unless explicitly overridden.

# Set a custom mount point
zfs set mountpoint=/var/www datapool/www

# Enable LZ4 compression (excellent performance/ratio balance)
zfs set compression=lz4 datapool/www

# Enforce a 20 GB hard quota on the dataset
zfs set quota=20G datapool/www

# Reserve 5 GB guaranteed space (prevents other datasets consuming it)
zfs set reservation=5G datapool/www

# Enable access time recording (default on; disable for performance)
zfs set atime=off datapool/www

# Verify properties
zfs get compression,quota,reservation,atime datapool/www

Step 7: Monitor Pool Health

ZFS continuously checksums all data and metadata. The zpool status command reports pool health and any detected errors.

# Show pool health and vdev layout
zpool status datapool

# Show I/O statistics (updated every 2 seconds)
zpool iostat datapool 2

# Run a scrub (reads all data and verifies checksums)
zpool scrub datapool

# Check scrub progress / results
zpool status datapool

Pool health states are ONLINE (healthy), DEGRADED (redundancy lost but data intact), FAULTED (data loss has occurred or is imminent), and UNAVAIL (device cannot be opened). Address any state other than ONLINE promptly.

Step 8: Snapshots and Rollback

ZFS snapshots are instant, space-efficient point-in-time copies. They consume no space at creation and only grow as the dataset changes (copy-on-write). Snapshots can be used for backup, rollback, or cloning.

# Create a snapshot (syntax: dataset@snapshot-name)
zfs snapshot datapool/www@before-update

# List all snapshots
zfs list -t snapshot

# Show how much space a snapshot is consuming
zfs list -t snapshot -o name,used,refer

# Roll back to a snapshot (destroys all changes since the snapshot)
zfs rollback datapool/www@before-update

# Destroy a snapshot when it is no longer needed
zfs destroy datapool/www@before-update

# Create recursive snapshots of a dataset and all children
zfs snapshot -r datapool/www@weekly-backup

Step 9: Replication with zfs send and zfs receive

ZFS replication transfers a snapshot stream — including all block-level changes — to another pool, potentially on a remote host. This is the most efficient way to replicate ZFS data because only changed blocks are transmitted after the initial seed.

# On the source server: create initial snapshot
zfs snapshot datapool/www@rep-2026-05-17

# Send the snapshot to a remote host (initial full replication)
# Pipe through SSH; the receiving server must also have ZFS installed
zfs send datapool/www@rep-2026-05-17 | 
    ssh backup-server "zfs receive backuppool/www"

# Create an incremental snapshot on the source
zfs snapshot datapool/www@rep-2026-05-18

# Send only the delta between two snapshots (much faster)
zfs send -i datapool/www@rep-2026-05-17 datapool/www@rep-2026-05-18 | 
    ssh backup-server "zfs receive backuppool/www"

# Verify the replica on the remote host
ssh backup-server "zfs list -t snapshot backuppool/www"

Step 10: ZFS vs LVM Comparison

LVM (Logical Volume Manager) has been the standard Linux volume management layer for over two decades and is deeply integrated with RHEL 7. Understanding where ZFS adds value helps you choose the right tool for a given workload.

  • Data integrity — ZFS checksums every block and silently corrects errors on redundant pools (self-healing). LVM passes I/O errors transparently to the file system without checksumming.
  • Snapshots — ZFS snapshots are instantaneous copy-on-write operations. LVM snapshots require pre-allocating a snapshot LV and can impose significant write overhead.
  • RAID — ZFS RAIDZ parity is recalculated per-write, eliminating the RAID-5 write hole. LVM mirrors rely on md and are subject to the classic write hole without a write-intent bitmap or journal.
  • Compression/deduplication — built into ZFS at the dataset level. LVM/ext4/xfs have no equivalent.
  • Caching (ARC/L2ARC/ZIL) — ZFS has an adaptive replacement cache in RAM, an optional SSD read cache (L2ARC), and an optional SSD write log (ZIL/SLOG). LVM uses the standard page cache.
  • Support — LVM + XFS is the fully supported RHEL 7 stack. ZFS on RHEL 7 is supported by the ZoL project but not by Red Hat; this matters for enterprise support contracts.

Conclusion

You have added the ZFS on Linux repository to a RHEL 7 system, installed the kmod ZFS packages, loaded the kernel module, created mirrored and RAIDZ pools, defined datasets with compression and quotas, monitored pool health with zpool status, taken and rolled back snapshots, and replicated data across servers using zfs send and zfs receive. ZFS brings enterprise-grade storage features to commodity hardware, and its copy-on-write architecture makes it particularly well suited for database servers, NAS appliances, backup targets, and any workload where data integrity is paramount. With the fundamentals covered here, you are well positioned to explore advanced topics such as L2ARC SSD caching, ZIL/SLOG devices for synchronous write acceleration, and automated snapshot management with tools like zfs-auto-snapshot.