{"id":4630,"date":"2020-01-03T14:21:32","date_gmt":"2020-01-03T20:21:32","guid":{"rendered":"http:\/\/icesquare.com\/wordpress\/?p=4630"},"modified":"2020-01-13T19:31:36","modified_gmt":"2020-01-14T01:31:36","slug":"zfs-how-to-update-linux-kernel-without-reboot","status":"publish","type":"post","link":"https:\/\/icesquare.com\/wordpress\/zfs-how-to-update-linux-kernel-without-reboot\/","title":{"rendered":"[ZFS On Linux]How to Update Linux Kernel without Rebooting the System"},"content":{"rendered":"<p>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 seconds. However with ZFS, it can take more than 60 seconds if the ZFS dataset is large (It takes time to unload and load the ZFS configurations). So I decide to experiment a new idea: Updating the kernel without rebooting the server. Keep in mind that this is not magic. This method will still introduce downtime, but it is much shorter comparing to rebooting the server. Base on my experience, it cuts about half of the downtime.<\/p>\n<p>Before you try it on a production server, I highly recommend you to try it on a test server\/VM first. If your server is a VM host, please be aware of the VM guests may get shut down after upgrade. You will need to wait the system to rebuild the VM modules with the new kernel headers first, then restart the VM guests.<\/p>\n<p>We will use kexec:<\/p>\n<pre>\r\nsudo yum install kexec-tools -y\r\n<\/pre>\n<p>Update the kernel, ZFS and DKMS modules<\/p>\n<pre>\r\nsudo yum update -y\r\n<\/pre>\n<p>Assuming that you are running an older kernel:<\/p>\n<pre>\r\nuname -a\r\n3.10.0-1062.4.1.el7.x86_64\r\n<\/pre>\n<p>If you open \/boot\/, you will notice that there are many newer kernels available:<\/p>\n<pre>\r\nls -al \/boot\/  | grep x86_64\r\n-rw-r--r--   1 root root 150K Oct 18 12:19 config-3.10.0-1062.4.1.el7.x86_64\r\n-rw-r--r--   1 root root 150K Nov 13 18:02 config-3.10.0-1062.4.3.el7.x86_64\r\n-rw-r--r--   1 root root 150K Dec  2 11:37 config-3.10.0-1062.7.1.el7.x86_64\r\n-rw-r--r--   1 root root 150K Dec  6 09:53 config-3.10.0-1062.9.1.el7.x86_64\r\n-rw-------   1 root root  30M Dec 13 00:03 initramfs-3.10.0-1062.4.1.el7.x86_64.img\r\n-rw-------   1 root root  13M Oct 22 15:41 initramfs-3.10.0-1062.4.1.el7.x86_64kdump.img\r\n-rw-------   1 root root  30M Nov 16 00:07 initramfs-3.10.0-1062.4.3.el7.x86_64.img\r\n-rw-------   1 root root  30M Dec  4 00:10 initramfs-3.10.0-1062.7.1.el7.x86_64.img\r\n-rw-------   1 root root  30M Dec  7 00:14 initramfs-3.10.0-1062.9.1.el7.x86_64.img\r\n-rw-r--r--   1 root root 312K Oct 18 12:19 symvers-3.10.0-1062.4.1.el7.x86_64.gz\r\n-rw-r--r--   1 root root 312K Nov 13 18:03 symvers-3.10.0-1062.4.3.el7.x86_64.gz\r\n-rw-r--r--   1 root root 312K Dec  2 11:37 symvers-3.10.0-1062.7.1.el7.x86_64.gz\r\n-rw-r--r--   1 root root 312K Dec  6 09:53 symvers-3.10.0-1062.9.1.el7.x86_64.gz\r\n-rw-------   1 root root 3.5M Oct 18 12:19 System.map-3.10.0-1062.4.1.el7.x86_64\r\n-rw-------   1 root root 3.5M Nov 13 18:02 System.map-3.10.0-1062.4.3.el7.x86_64\r\n-rw-------   1 root root 3.5M Dec  2 11:37 System.map-3.10.0-1062.7.1.el7.x86_64\r\n-rw-------   1 root root 3.5M Dec  6 09:53 System.map-3.10.0-1062.9.1.el7.x86_64\r\n-rwxr-xr-x   1 root root 6.5M Oct 18 12:19 vmlinuz-3.10.0-1062.4.1.el7.x86_64\r\n-rw-r--r--   1 root root  171 Oct 18 12:19 .vmlinuz-3.10.0-1062.4.1.el7.x86_64.hmac\r\n-rwxr-xr-x   1 root root 6.5M Nov 13 18:02 vmlinuz-3.10.0-1062.4.3.el7.x86_64\r\n-rw-r--r--   1 root root  171 Nov 13 18:02 .vmlinuz-3.10.0-1062.4.3.el7.x86_64.hmac\r\n-rwxr-xr-x   1 root root 6.5M Dec  2 11:37 vmlinuz-3.10.0-1062.7.1.el7.x86_64\r\n-rw-r--r--   1 root root  171 Dec  2 11:37 .vmlinuz-3.10.0-1062.7.1.el7.x86_64.hmac\r\n-rwxr-xr-x   1 root root 6.5M Dec  6 09:53 vmlinuz-3.10.0-1062.9.1.el7.x86_64\r\n-rw-r--r--   1 root root  171 Dec  6 09:53 .vmlinuz-3.10.0-1062.9.1.el7.x86_64.hmac\r\n<\/pre>\n<p>Pick the newest one. In the other words, we will do the following:<\/p>\n<pre>\r\nFrom: 3.10.0-1062.4.1.el7.x86_64\r\nTo: 3.10.0-1062.9.1.el7.x86_64\r\n<\/pre>\n<p>Before we begin, we want to make sure that all of the ZFS \/ dkms modules have been installed. Make sure that the latest one (3.10.0-1062.9.1.el7) is available:<\/p>\n<pre>\r\nsudo dkms status\r\nzfs, 0.8.2, 3.10.0-1062.4.1.el7.x86_64, x86_64: installed\r\nzfs, 0.8.2, 3.10.0-1062.4.3.el7.x86_64, x86_64: installed\r\nzfs, 0.8.2, 3.10.0-1062.7.1.el7.x86_64, x86_64: installed\r\nzfs, 0.8.2, 3.10.0-1062.9.1.el7.x86_64, x86_64: installed\r\n<\/pre>\n<p>Keep in mind that my current system is still running the old kernel (3.10.0-1062.4.1.el7.x86_64): <\/p>\n<pre>\r\nuname -a\r\n3.10.0-1062.4.1.el7.x86_64\r\n\r\nmodinfo zfs | grep version\r\nversion:        0.8.2-1\r\nrhelversion:    7.7\r\nsrcversion:     29C160FF878154256C93164\r\nvermagic:       3.10.0-1062.4.1.el7.x86_64 SMP mod_unload modversions\r\n<\/pre>\n<p>Now, we will use kexec to load the new kernel. Please replace the kernel version with the latest one in your system.<\/p>\n<pre>\r\nsudo kexec -u\r\nsudo kexec -l \/boot\/vmlinuz-3.10.0-1062.9.1.el7.x86_64 --initrd=\/boot\/initramfs-3.10.0-1062.9.1.el7.x86_64.img  --reuse-cmdline\r\n<\/pre>\n<p>After running the following command, it will introduce downtime. Based on my experience, it should be no longer than 30 seconds. However, I recommend you to test it using a non-production server first.<\/p>\n<pre>\r\nsudo systemctl kexec\r\n<\/pre>\n<p>During the update, your remote session may be ended. After waiting for 15-30s, try to connect to server again.<\/p>\n<p>Verify the kernel has been updated:<\/p>\n<pre>\r\nuname -a\r\n3.10.0-1062.9.1.el7.x86_64\r\n\r\nmodinfo zfs | grep version\r\nversion:        0.8.2-1\r\nrhelversion:    7.7\r\nsrcversion:     29C160FF878154256C93164\r\nvermagic:       3.10.0-1062.9.1.el7.x86_64 SMP mod_unload modversions\r\n<\/pre>\n<p>Clean up the old kernels:<\/p>\n<pre>\r\nsudo package-cleanup --oldkernels --count=1 -y; \r\nsudo dkms remove zfs\/0.8.2 -k 3.10.0-1062.4.1.el7.x86_64;\r\nsudo dkms remove zfs\/0.8.2 -k 3.10.0-1062.4.3.el7.x86_64;\r\nsudo dkms remove zfs\/0.8.2 -k 3.10.0-1062.7.1.el7.x86_64;\r\nsudo dkms status;\r\n<\/pre>\n<p>Now your system is good to go.<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 <a class=\"more-link\" href=\"https:\/\/icesquare.com\/wordpress\/zfs-how-to-update-linux-kernel-without-reboot\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_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":[94,6,109],"tags":[178,177],"class_list":["post-4630","post","type-post","status-publish","format-standard","hentry","category-computer-problems-computer-help-pc-support","category-technology","category-zfs","tag-kernel","tag-zfs"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p1sqzr-1cG","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"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":4630,"position":0},"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":4202,"url":"https:\/\/icesquare.com\/wordpress\/centosrhel-7-no-zfs-after-updating-the-kernel\/","url_meta":{"origin":4630,"position":1},"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":4436,"url":"https:\/\/icesquare.com\/wordpress\/how-to-fix-the-mess-created-by-zfs-on-linux-after-update\/","url_meta":{"origin":4630,"position":2},"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":4286,"url":"https:\/\/icesquare.com\/wordpress\/how-to-install-zfs-on-rhel-centos-7\/","url_meta":{"origin":4630,"position":3},"title":"How to install ZFS on RHEL \/ CentOS 7","author":"Derrick","date":"January 4, 2017","format":false,"excerpt":"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. Before you decide to put ZFS in a production use, you should be aware of the following: ZFS is originally\u2026","rel":"","context":"In &quot;Everyday Computer Problem&quot;","block_context":{"text":"Everyday Computer Problem","link":"https:\/\/icesquare.com\/wordpress\/category\/everyday-computer-problem\/"},"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":3914,"url":"https:\/\/icesquare.com\/wordpress\/zfs-linux-vs-freebsd\/","url_meta":{"origin":4630,"position":4},"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":4630,"position":5},"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":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4630","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=4630"}],"version-history":[{"count":16,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4630\/revisions"}],"predecessor-version":[{"id":4676,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4630\/revisions\/4676"}],"wp:attachment":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/media?parent=4630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/categories?post=4630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/tags?post=4630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}