Install ZFS on CentOS 7.9

Here ya go!

cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

Now go to: http://download.zfsonlinux.org/epel/

Find the zfs-release version

Mine is zfs-release.el7_9.noarch.rpm

Install

yum install http://download.zfsonlinux.org/epel/zfs-release.el7_9.noarch.rpm

ZFS repository should be added.

There are two ways ZFS module can be loaded to the kernel, DKMS and kABI. The difference between these is that if you install DKMS based ZFS module, and then for some reason you update the kernel of your operating system, the ZFS kernel module must be recompiled again. Otherwise it won’t work. But the kABI based ZFS module has the upper hand in that it doesn’t require recompilation if the kernel of the operating system is updated.

In this article, I will install the kABI based ZFS kernel module.

When you install the ZFS repository on CentOS 7, the DKMS based repository is enabled by default. So you have to disable DKMS based repository and enable the kABI based repository.

To disable the DKMS based ZFS repository and enable kABI based ZFS repository, first open the yum configuration file of ZFS with a text editor with the following command:

sudo nano /etc/yum.repos.d/zfs.repo

Before:

[zfs]
name=ZFS on Linux for EL7 - dkms
baseurl=http://download.zfsonlinux.org/epel/7.9/$basearch/
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux

[zfs-kmod]
name=ZFS on Linux for EL7 - kmod
baseurl=http://download.zfsonlinux.org/epel/7.9/kmod/$basearch/
enabled=0
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux

After

[zfs]
name=ZFS on Linux for EL7 - dkms
baseurl=http://download.zfsonlinux.org/epel/7.9/$basearch/
enabled=0
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux

[zfs-kmod]
name=ZFS on Linux for EL7 - kmod
baseurl=http://download.zfsonlinux.org/epel/7.9/kmod/$basearch/
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux

Now you can install ZFS File System on your CentOS 7 with the following command:

sudo yum install zfs

Now reboot your computer with the following command:

sudo reboot

Once your computer starts, run the following command to check whether ZFS kernel module is loaded.

sudo lsmod | grep zfs
zfs                  4224878  6
zunicode              331170  1 zfs
zzstd                 460780  1 zfs
zlua                  151526  1 zfs
zcommon                94285  1 zfs
znvpair                94388  2 zfs,zcommon
zavl                   15698  1 zfs
icp                   301775  1 zfs
spl                    96750  6 icp,zfs,zavl,zzstd,zcommon,znvpair

You may not see any output. If you don’t see any output, then ZFS kernel module is not loaded. In that case, run the following command to load the ZFS kernel module manually.

sudo modprobe zfs

Now if you run lsmod command again, you should see ZFS kernel module loaded as shown in the screenshot below.

sudo lsmod | grep zfs
zfs                  4224878  6
zunicode              331170  1 zfs
zzstd                 460780  1 zfs
zlua                  151526  1 zfs
zcommon                94285  1 zfs
znvpair                94388  2 zfs,zcommon
zavl                   15698  1 zfs
icp                   301775  1 zfs
spl                    96750  6 icp,zfs,zavl,zzstd,zcommon,znvpair

Since I had a zpool, I will import it.

[root@skynet ~]# sudo zpool import
   pool: myzpool
     id: 13464327419314907931
  state: ONLINE
status: The pool was last accessed by another system.
 action: The pool can be imported using its name or numeric identifier and
        the '-f' flag.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-EY
 config:

        myzpool                                         ONLINE
          mirror-0                                      ONLINE
            ata-WDC_WD2002FFSX-68PF8N0_WD-WCC6N7PRY8JJ  ONLINE
            ata-WDC_WD2002FFSX-68PF8N0_WD-WCC6N7PRY1VJ  ONLINE

sudo  zpool import -f myzpool

Leave a Comment