{"id":4286,"date":"2017-01-04T01:07:48","date_gmt":"2017-01-04T07:07:48","guid":{"rendered":"http:\/\/icesquare.com\/wordpress\/?p=4286"},"modified":"2018-12-12T17:33:05","modified_gmt":"2018-12-12T23:33:05","slug":"how-to-install-zfs-on-rhel-centos-7","status":"publish","type":"post","link":"https:\/\/icesquare.com\/wordpress\/how-to-install-zfs-on-rhel-centos-7\/","title":{"rendered":"How to install ZFS on RHEL \/ CentOS 7"},"content":{"rendered":"<p>A friend of mine likes to try ZFS on CentOS 7, therefore I decide to make a guide for him. The following instructions have been well tested on CentOS 7.<\/p>\n<p>Before you decide to put ZFS in a production use, you should be aware of the following:<\/p>\n<ul>\n<li>ZFS is originally designed to work with Solaris and BSD system. Because of the legal and licensing issues, ZFS cannot be shipped with Linux.<\/li>\n<li>Since ZFS is open source, some developers port the ZFS the Linux, and make it run at the kernel level via dkms. This works great as long as you don&#8217;t update the kernel. Otherwise the ZFS will not be loaded with the new kernel.<\/li>\n<li>In a ZFS\/Linux environment, it is a bad idea to update the system automatically.<\/li>\n<li>For some odd reasons, ZFS\/Linux will work with server grade or gaming grade computers. Do not run ZFS\/Linux on entry level computers.<\/li>\n<\/ul>\n<h2>Instructions<\/h2>\n<p>By default, ZFS is not available in the standard CentOS repository. We will need to include some 3rd party repositories here.<\/p>\n<pre>\r\nsudo rpm -Uvh http:\/\/www.elrepo.org\/elrepo-release-7.0-2.el7.elrepo.noarch.rpm\r\nsudo rpm -Uvh http:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-7.noarch.rpm\r\nsudo rpm -Uvh https:\/\/forensics.cert.org\/cert-forensics-tools-release-el7.rpm\r\nsudo rpm -Uvh http:\/\/download.zfsonlinux.org\/epel\/zfs-release.el7_6.noarch.rpm\r\n\r\nsudo yum update -y\r\nsudo yum groupinstall -y \"Development Tools\" \"Development Libraries\" \"Additional Development\"\r\nsudo yum install -y kernel-devel kernel-headers\r\n<\/pre>\n<p>It is very likely that the system will install a new kernel. You may want to reboot the computer before installing the ZFS.<\/p>\n<pre>\r\nsudo reboot\r\n<\/pre>\n<p>Please make sure that the system does not update automatically. If you need to update the system, please exclude the kernel and related modules from the update.<\/p>\n<pre>\r\nsudo nano \/etc\/yum.conf \r\nexclude=kernel*\r\n<\/pre>\n<p>Now you are on the latest kernel. Let&#8217;s install the ZFS:<\/p>\n<pre>\r\nsudo yum install -y zfs\r\nsudo \/sbin\/modprobe zfs\r\n<\/pre>\n<p>Now, you can create a simple stripped ZFS. Stripped ZFS gives you the best performances and zero data protections. When referencing the disks, we don&#8217;t want to use \/dev\/sd*, instead, we want to use the device id directly, e.g., \/dev\/disk\/by-id\/wwn-0x8000c8004e8ac11a<\/p>\n<pre>\r\nls \/dev\/disk\/by-id\/\r\n\r\n\r\nlrwxrwxrwx 1 root root  9 Jan  3 21:49 wwn-0x8000c8004e8ac11a -> ..\/..\/sde\r\nlrwxrwxrwx 1 root root  9 Jan  3 21:49 wwn-0x8000c8008ad0a22d -> ..\/..\/sdd\r\nlrwxrwxrwx 1 root root  9 Jan  3 21:49 wwn-0x8000c8008b4f6338 -> ..\/..\/sda\r\nlrwxrwxrwx 1 root root  9 Jan  3 21:49 wwn-0x8000c8008b52144c -> ..\/..\/sdc\r\nlrwxrwxrwx 1 root root  9 Jan  3 21:49 wwn-0x8000c8008b59a553 -> ..\/..\/sdb\r\n<\/pre>\n<p>Once you identify the list of the hard disks, we can create a simple stripped ZFS. This will create a ZFS under <strong>\/storage<\/strong>. You can replace <strong>storage<\/strong> to anything you like.<\/p>\n<pre>\r\n#We are going to create a ZFS pool with three disks. You can add more if you like. For stripped design, the higher number of disks, the faster the IO speed.\r\nzpool create -f storage \/dev\/disk\/by-id\/device1 \/dev\/disk\/by-id\/device2 \/dev\/disk\/by-id\/device3 \r\n<\/pre>\n<p>storage is like a big umbrella. Under this umbrella, we will need to create multiple &#8220;partitions&#8221; for storing data.<\/p>\n<pre>\r\nzfs create storage\/mydata\r\n<\/pre>\n<p>If you have a fast CPU like i7, you may want to turn on the compression. This will reduce the amount of data write to the system, and it will improve the overall performance.<\/p>\n<pre>\r\nsudo zfs set compression=lz4 storage\r\n<\/pre>\n<p>Finally we want to change the ownership and the permissions<\/p>\n<pre>\r\n#Assuming that you are part of the wheel group\r\nsudo chown -R root:wheel \/storage\r\nsudo chmod -R g+rw \/storage\r\n<\/pre>\n<p>Now, run df and you should be able to see the ZFS in your system.<\/p>\n<pre>\r\n#df -h\r\nFilesystem                   Size  Used Avail Use% Mounted on\r\nstorage                      6.8T  128K  6.8T   1% \/storage\r\nstorage\/mydata                13T  6.1T  6.8T  48% \/storage\/mydata\r\n<\/pre>\n<p>You can monitor the health of the ZFS system.<\/p>\n<pre>\r\n#sudo zpool status\r\n\r\n\r\n\r\n  pool: storage\r\n state: ONLINE\r\nconfig:\r\n\r\n        NAME                        STATE     READ WRITE CKSUM\r\n        storage                     ONLINE       0     0     0\r\n            wwn-0x8000c8004e8ac11a  ONLINE       0     0     0\r\n            wwn-0x8000c8008ad0a22d  ONLINE       0     0     0\r\n            wwn-0x8000c8008b4f6338  ONLINE       0     0     0\r\n            wwn-0x8000c8008b52144c  ONLINE       0     0     0\r\n\r\n\r\nerrors: No known data errors\r\n<\/pre>\n<p>For some very odd reasons, ZFS will not be loaded automatically. We want to make sure that ZFS will be loaded after reboot.<\/p>\n<pre>\r\n#sudo nano \/etc\/crontab\r\n\r\n#Add the following:\r\n@reboot         root    sleep 10; zpool import -a;\r\n<\/pre>\n<p>Now you can try to test the ZFS by running dd or copying a big file to the ZFS. If you are not happy with the configurations, you can always destroy it and re-create the ZFS again.<\/p>\n<pre>\r\nsudo zpool destroy storage\r\n<\/pre>\n<h2>Further Reading<\/h2>\n<ul>\n<li><a target='_blank' href='\/wordpress\/zfs-linux-vs-freebsd\/'>Running ZFS on Linux: Things you should know and be aware of<\/a><\/li>\n<li><a target='_blank' href='\/wordpress\/zfs-performance-mirror-vs-raidz-vs-raidz2-vs-raidz3-vs-striped\/'>ZFS Performance: Mirror VS RAIDZ VS RAIDZ2 vs RAIDZ3 vs Striped<\/a><\/li>\n<li><a target='_blank' href='\/wordpress\/how-to-fix-the-mess-created-by-zfs-on-linux-after-update\/'>How to fix ZFS after updating to a newer kernel<\/a><\/li>\n<li><a target='_blank' href='\/wordpress\/how-to-improve-zfs-performance\/'>How to improve ZFS performance<\/a><\/li>\n<\/ul>\n<p>Have fun!<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A friend of mine likes to try ZFS on CentOS 7, therefore I decide to make a guide for him. The following instructions have been well tested on CentOS 7. <a class=\"more-link\" href=\"https:\/\/icesquare.com\/wordpress\/how-to-install-zfs-on-rhel-centos-7\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1260,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[146,144,6,109],"tags":[48,177],"class_list":["post-4286","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-everyday-computer-problem","category-sever-problem","category-technology","category-zfs","tag-linux","tag-zfs"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p1sqzr-178","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":4436,"url":"https:\/\/icesquare.com\/wordpress\/how-to-fix-the-mess-created-by-zfs-on-linux-after-update\/","url_meta":{"origin":4286,"position":0},"title":"&#8220;ZFS on Linux&#8221;: The ZFS modules are not loaded. Try running &#8216;\/sbin\/modprobe zfs&#8217; as root to load them.","author":"Derrick","date":"April 10, 2018","format":false,"excerpt":"Last Updated: Oct 10, 2021 This article is based on my experience with CentOS 7. If you are running other Linux distributions, please adjust the commands and package names accordingly (e.g., yum --> apt-get). As of Oct 3, 2019, I cannot get ZFS on Linux running on CentOS 8. ZFS\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3914,"url":"https:\/\/icesquare.com\/wordpress\/zfs-linux-vs-freebsd\/","url_meta":{"origin":4286,"position":1},"title":"Running ZFS on Linux: Things you should know and be aware of","author":"Derrick","date":"February 29, 2016","format":false,"excerpt":"First Published: Feb 29, 2016 Last Revised: January 10, 2026 ZFS is a next-generation file system renowned for its reliability and advanced features. However, due to legal and licensing issues, it is not included by default in most Linux distributions. Fortunately, you can still install (ZFS on Linux) with just\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4005,"url":"https:\/\/icesquare.com\/wordpress\/centos-6-no-zfs-after-upgrading-the-kernel\/","url_meta":{"origin":4286,"position":2},"title":"CentOS\/RHEL 6: No ZFS after upgrading the kernel","author":"Derrick","date":"March 2, 2016","format":false,"excerpt":"This article is mainly for CentOS 6, please visit here for CentOS 7. After I upgraded the CentOS \/ RHEL system to the latest kernel, the ZFS failed to start. The system was unable to load the ZFS module, i.e., I could not access my data. Here are some error\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/icesquare.com\/wordpress\/wp-content\/uploads\/2011\/01\/zfs_logo.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4202,"url":"https:\/\/icesquare.com\/wordpress\/centosrhel-7-no-zfs-after-updating-the-kernel\/","url_meta":{"origin":4286,"position":3},"title":"CentOS\/RHEL 7 &#8211; No ZFS After Updating the Kernel","author":"Derrick","date":"December 12, 2016","format":false,"excerpt":"Let's all agree with this fact: ZFS is foreign to Linux. It is not native. You can't expect that ZFS on Linux will run smoothly as FreeBSD or Solaris. Having using ZFS on Linux since 2013 (and ZFS on FreeBSD since 2009), I've noticed that ZFS does not like Linux\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4679,"url":"https:\/\/icesquare.com\/wordpress\/zfs-on-linux-trouble-this-pool-uses-the-following-features-not-supported-by-this-system-all-unsupported-features-are-only-required-for-writing-to-the-pool\/","url_meta":{"origin":4286,"position":4},"title":"[ZFS On Linux Trouble] This pool uses the following feature(s) not supported by this system&#8230;All unsupported features are only required for writing to the pool, zpool create: invalid argument for this pool operation","author":"Derrick","date":"February 11, 2020","format":false,"excerpt":"When I rebooted my computer and loaded my ZFS pool today, I got this error message: #sudo zpool import -a This pool uses the following feature(s) not supported by this system: org.zfsonlinux:project_quota (space\/object accounting based on project ID.) com.delphix:spacemap_v2 (Space maps representing large segments are more efficient.) All unsupported features\u2026","rel":"","context":"In &quot;Technology&quot;","block_context":{"text":"Technology","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4630,"url":"https:\/\/icesquare.com\/wordpress\/zfs-how-to-update-linux-kernel-without-reboot\/","url_meta":{"origin":4286,"position":5},"title":"[ZFS On Linux]How to Update Linux Kernel without Rebooting the System","author":"Derrick","date":"January 3, 2020","format":false,"excerpt":"As of Jan 2020, I manage 65 Linux + ZFS servers. Normally, I prefer to reboot each server after updating its kernel (according to Ret Hat, most updates are related to security fix). Without ZFS, it is not a big issue because rebooting a basic Linux server takes about 30\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"https:\/\/icesquare.com\/wordpress\/wp-content\/uploads\/2011\/01\/zfs_logo.jpg","_links":{"self":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/comments?post=4286"}],"version-history":[{"count":24,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4286\/revisions"}],"predecessor-version":[{"id":4536,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4286\/revisions\/4536"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/media\/1260"}],"wp:attachment":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/media?parent=4286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/categories?post=4286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/tags?post=4286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}