{"id":8953,"date":"2023-10-21T18:00:03","date_gmt":"2023-10-21T18:00:03","guid":{"rendered":"https:\/\/www.linuxandotherstuff.com\/?p=8953"},"modified":"2023-10-22T01:46:16","modified_gmt":"2023-10-22T01:46:16","slug":"install-zfs-on-centos-7-9","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2023\/10\/21\/install-zfs-on-centos-7-9\/","title":{"rendered":"Install ZFS  on CentOS 7.9"},"content":{"rendered":"\n<p>Here ya go!<\/p>\n\n\n\n<p><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncat \/etc\/redhat-release\nCentOS Linux release 7.9.2009 (Core)\n<\/pre><\/div>\n\n\n<p>Now go to: http:\/\/download.zfsonlinux.org\/epel\/<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Find the zfs-release version<\/p>\n\n\n\n<p>Mine is zfs-release.el7_9.noarch.rpm<\/p>\n\n\n\n<p>Install<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nyum install http:\/\/download.zfsonlinux.org\/epel\/zfs-release.el7_9.noarch.rpm\n<\/pre><\/div>\n\n\n<p>ZFS repository should be added.<\/p>\n\n\n\n<p>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\u2019t work. But the kABI based ZFS module has the upper hand in that it doesn\u2019t require recompilation if the kernel of the operating system is updated.<\/p>\n\n\n\n<p>In this article, I will install the kABI based ZFS kernel module.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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:<\/p>\n\n\n\n<p><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsudo nano \/etc\/yum.repos.d\/zfs.repo\n<\/pre><\/div>\n\n\n<p>Before:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;zfs]\nname=ZFS on Linux for EL7 - dkms\nbaseurl=http:\/\/download.zfsonlinux.org\/epel\/7.9\/$basearch\/\nenabled=1\nmetadata_expire=7d\ngpgcheck=1\ngpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-zfsonlinux\n\n&#x5B;zfs-kmod]\nname=ZFS on Linux for EL7 - kmod\nbaseurl=http:\/\/download.zfsonlinux.org\/epel\/7.9\/kmod\/$basearch\/\nenabled=0\nmetadata_expire=7d\ngpgcheck=1\ngpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-zfsonlinux\n\n<\/pre><\/div>\n\n\n<p>After<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n&#x5B;zfs]\nname=ZFS on Linux for EL7 - dkms\nbaseurl=http:\/\/download.zfsonlinux.org\/epel\/7.9\/$basearch\/\nenabled=0\nmetadata_expire=7d\ngpgcheck=1\ngpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-zfsonlinux\n\n&#x5B;zfs-kmod]\nname=ZFS on Linux for EL7 - kmod\nbaseurl=http:\/\/download.zfsonlinux.org\/epel\/7.9\/kmod\/$basearch\/\nenabled=1\nmetadata_expire=7d\ngpgcheck=1\ngpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-zfsonlinux\n\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"610\" height=\"720\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/10\/2023-10-21-20-44-21.png\" alt=\"\" class=\"wp-image-8968\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/10\/2023-10-21-20-44-21.png 610w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/10\/2023-10-21-20-44-21-254x300.png 254w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/figure>\n\n\n\n<p>Now you can install ZFS File System on your CentOS 7 with the following command:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo yum install zfs\n<\/pre><\/div>\n\n\n<p>Now reboot your computer with the following command:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo reboot\n<\/pre><\/div>\n\n\n<p>Once your computer starts, run the following command to check whether ZFS kernel module is loaded.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo lsmod | grep zfs\nzfs                  4224878  6\nzunicode              331170  1 zfs\nzzstd                 460780  1 zfs\nzlua                  151526  1 zfs\nzcommon                94285  1 zfs\nznvpair                94388  2 zfs,zcommon\nzavl                   15698  1 zfs\nicp                   301775  1 zfs\nspl                    96750  6 icp,zfs,zavl,zzstd,zcommon,znvpair\n\n<\/pre><\/div>\n\n\n<p>You may not see any output. If you don\u2019t see any output, then ZFS kernel module is not loaded. In that case, run the following command to load the ZFS kernel module manually.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo modprobe zfs\n<\/pre><\/div>\n\n\n<p>Now if you run <strong>lsmod<\/strong> command again, you should see ZFS kernel module loaded as shown in the screenshot below.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo lsmod | grep zfs\nzfs                  4224878  6\nzunicode              331170  1 zfs\nzzstd                 460780  1 zfs\nzlua                  151526  1 zfs\nzcommon                94285  1 zfs\nznvpair                94388  2 zfs,zcommon\nzavl                   15698  1 zfs\nicp                   301775  1 zfs\nspl                    96750  6 icp,zfs,zavl,zzstd,zcommon,znvpair\n<\/pre><\/div>\n\n\n<p>Since I had a zpool, I will import it.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@skynet ~]# sudo zpool import\n   pool: myzpool\n     id: 13464327419314907931\n  state: ONLINE\nstatus: The pool was last accessed by another system.\n action: The pool can be imported using its name or numeric identifier and\n        the &#039;-f&#039; flag.\n   see: https:\/\/openzfs.github.io\/openzfs-docs\/msg\/ZFS-8000-EY\n config:\n\n        myzpool                                         ONLINE\n          mirror-0                                      ONLINE\n            ata-WDC_WD2002FFSX-68PF8N0_WD-WCC6N7PRY8JJ  ONLINE\n            ata-WDC_WD2002FFSX-68PF8N0_WD-WCC6N7PRY1VJ  ONLINE\n\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo  zpool import -f myzpool\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Here ya go! Now go to: http:\/\/download.zfsonlinux.org\/epel\/ Find the zfs-release version Mine is zfs-release.el7_9.noarch.rpm Install 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 &#8230; <a title=\"Install ZFS  on CentOS 7.9\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2023\/10\/21\/install-zfs-on-centos-7-9\/\" aria-label=\"Read more about Install ZFS  on CentOS 7.9\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-8953","post","type-post","status-publish","format-standard","hentry","category-centos-7"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/8953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=8953"}],"version-history":[{"count":5,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/8953\/revisions"}],"predecessor-version":[{"id":8969,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/8953\/revisions\/8969"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=8953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=8953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=8953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}