How to install and setup ZFS in Rocky Linux 9

Introduction to ZFS

Zettabyte File System (ZFS) is an advanced file system originally developed by SunMicrosystems. The most important features that distinguish ZFS from other filing systems are its high storage capacity and protection against data corruption.

ZFS was originally developed by SunMicrosystems as part of Solaris. After the OpenSolaris project was launched, ZFS was released as open source software. With the acquisition of SunMicrosystems by Oracle in 2010, the ZFS source code was discontinued and an attempt was made to convert it to closed source. After that, he started the open-source OpenZFS project, which includes ZFS entirely.



Install ZFS on Rocky Linux 9

Let's install ZFS, one of the best file systems, on Rocky Linux 9.


Step-1: Install zfs-release

Let's start by installing the zfs release package for Rocky Linux 9 from zfsonlinux official github address:

[foc@rocky9 ~]$ sudo dnf install -y


Step-2: Install epel-release

Then install the epel-release package to use the epel repository:

[foc@rocky9 ~]$ sudo dnf install -y epel-release

List the available repos

[foc@rocky9 ~]$ dnf repolist

How to install and setup ZFS in Rocky Linux 9


Step-3: Install DKMS Package

Epel repository is  active. Install the dkms package from this repository:

[foc@rocky9 ~]$ sudo dnf install -y dkms


Step-4: Install ZFS Package

In order to install the kABI-tracking kmods the default repository must be switched from zfs to zfs-kmod:

[foc@rocky9 ~]$ sudo dnf config-manager --disable zfs
[foc@rocky9 ~]$ sudo dnf config-manager --enable zfs-kmod

If zfs is enabled instead of zfs-kmod, too many dependent packages will be installed on the system. Also, you will encounter an error while adding the module to the kernel.

Finally setup zfs package:

[foc@rocky9 ~]$ sudo dnf install zfs -y

The zfs package was installed on the system with its dependencies.


Step-5: Enable zfs module in Kernel

After installation, the zfs module should be added to the kernel:

[foc@rocky9 ~]$ sudo modprobe zfs

Verify that the module is successfully enabled:

How to install and setup ZFS in Rocky Linux 9

Installation completed successfully. Let's check the version:

[foc@rocky9 ~]$ zfs version


Setup ZFS Pool

Create ZFS Pool (Mirror)

You’re now ready to create a pool on your attached disks. To list the available disks we can use lsblk command:

How to install and setup ZFS in Rocky Linux 9

Here we have 3 disks attached to our server i.e. /dev/sda, /dev/sdb and /dev/sdc. We can't use /dev/sda as it is used for storing our system and OS data. So we have /dev/sdb and /dev/sdc on which we can create a pool.

In this example we will create a mirror pool where one disk will act as a mirror to another disk.

[root@server ~]# zpool create -f datapool mirror /dev/sdb /dev/sdc


Check ZFS Pool status

Check the status of the newly created pool using zpool command:

[root@server ~]# zpool status
  pool: datapool
 state: ONLINE

	datapool    ONLINE       0     0     0
	  mirror-0  ONLINE       0     0     0
	    sdb     ONLINE       0     0     0
	    sdc     ONLINE       0     0     0

errors: No known data errors

[root@server ~]# zpool list
datapool  1.88G   100K  1.87G        -         -     0%     0%  1.00x    ONLINE  -

Verify the partition

How to install and setup ZFS in Rocky Linux 9

[root@server ~]# df -h /datapool/
Filesystem      Size  Used Avail Use% Mounted on
datapool        1.8G  128K  1.8G   1% /datapool


Destroy or Delete a ZFS Pool

We can use zfs destroy command to completely delete a zfs pool:

[root@server ~]# zpool destroy datapool

[root@server ~]# df -h /datapool/
df: /datapool/: No such file or directory




You can get detailed information about zfs with the following command:

[foc@rocky9 ~]$ man zfs

For all the work you can do with zfs, the following command will help:

[foc@rocky9 ~]$ zfs --help
usage: zfs command args ...
where 'command' is one of the following:
	create [-Pnpuv] [-o property=value] ... <filesystem>
	create [-Pnpsv] [-b blocksize] [-o property=value] ... -V <size> <volume>


References - RHEL Root on ZFS


Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment