{"id":4648,"date":"2020-01-13T19:28:51","date_gmt":"2020-01-14T01:28:51","guid":{"rendered":"http:\/\/icesquare.com\/wordpress\/?p=4648"},"modified":"2020-04-16T12:17:08","modified_gmt":"2020-04-16T17:17:08","slug":"zfs-on-linux-what-to-do-when-resilver-takes-very-long","status":"publish","type":"post","link":"https:\/\/icesquare.com\/wordpress\/zfs-on-linux-what-to-do-when-resilver-takes-very-long\/","title":{"rendered":"[ZFS On Linux] What to Do When Resilver Takes Very Long"},"content":{"rendered":"<p>If you check your Zpool health status and you notice an error like the following:<\/p>\n<pre>\r\nsudo zpool status\r\n  pool: myzpool\r\n state: DEGRADED\r\nstatus: One or more devices are faulted in response to persistent errors.\r\n        Sufficient replicas exist for the pool to continue functioning in a\r\n        degraded state.\r\naction: Replace the faulted device, or use 'zpool clear' to mark the device\r\n        repaired.\r\n  scan: resilvered 49.6G in 0 days 00:11:25 with 0 errors on Fri Jan 10 15:52:05 2020\r\nconfig:\r\n\r\n        NAME                                            STATE     READ WRITE CKSUM\r\n        myzpool                                         DEGRADED     0     0     0\r\n          raidz1-0                                      DEGRADED     0     0     0\r\n            ata-TOSHIBA_0001                            ONLINE       0     0     0\r\n            ata-TOSHIBA_0002                            ONLINE       0     0     0\r\n            ata-TOSHIBA_0003                            FAULTED     36     0     0  too many errors\r\n        cache\r\n          nvme0n1                                       ONLINE       0     0     0\r\n\r\n<\/pre>\n<p>There are two possibilities: hardware error or software error. I will perform the following to identify whether it is hardware or software error.<\/p>\n<ol>\n<li>Check whether the disk is missing from the system or not. You can do it by running <code>fdisk -l<\/code>. If the disk is available, try to clear the ZFS status. If the disk is missing, try to reboot the system.<\/li>\n<li>If the disk is still missing after reboot the system, try to replace the hard drive cable.<\/li>\n<li>Once the ZFS sees all disks, try to run <code>zpool clear myzpool<\/code>. This will force the ZFS to resilver the pool. If the pool is running at 100MB\/s or above, it sounds like a false alarm. You may stop here.<\/li>\n<\/ol>\n<hr \/>\n<p>Assuming that it is hardware related error. Typically you can do the following:<\/p>\n<ul>\n<li>Replace the SATA \/ SAS cable<\/li>\n<li>Replace the hard drive<\/li>\n<li>In the BIOS settings, change the write mode from SATA\/IDE to AHCI<\/li>\n<\/ul>\n<p>If you replace the hard drive, you will need to resilver the pool. If it is hardware error, the pool will read\/write the data at least 100MB\/s. Depending on the size of data on your faulty disk, it should take no more than 3 days to finish the entire process. Wait until the process is finished. If it gives no error, you may stop here.<\/p>\n<pre>\r\nsudo zpool status\r\n  pool: myzpool\r\n state: ONLINE\r\n  scan: resilvered 215M in 0 days 00:00:04 with 0 errors on Mon Jan 13 18:24:48 2020\r\nconfig:\r\n\r\n        NAME                                            STATE     READ WRITE CKSUM\r\n        myzpool                                         ONLINE       0     0     0\r\n          raidz1-0                                      ONLINE       0     0     0\r\n            ata-TOSHIBA_0001                            ONLINE       0     0     0\r\n            ata-TOSHIBA_0002                            ONLINE       0     0     0\r\n            ata-TOSHIBA_0003                            ONLINE       0     0     0\r\n        cache\r\n          nvme0n1                                       ONLINE       0     0     0\r\n\r\nerrors: No known data errors\r\n<\/pre>\n<hr \/>\n<p>So you may be in one or more of the following situations:<\/p>\n<ul>\n<li>Your hardware is consumer level, e.g., the motherboard is not server grade, or the hard drive is designed for general purposes rather than 24\/7.<\/li>\n<li>You have replaced the hard drive, and the resilver process is very slow (e.g., 5-15MB\/s). The ZFS cannot even give you an estimated finish time. <\/li>\n<li>The resilver estimated end time keeps being delayed, and it seems taking forever. For example, suppose ZFS estimates that the entire process may take 10 hours to finish. After 5 hours, it says 9 more hours to go, or once it reaches 99.9%, it starts the entire process again.<\/li>\n<li>When you run <code>dmesg<\/code>, you see a lot of hardware related error, e.g.,\n<pre>\r\nata2.00: status: { DRDY }\r\nata2.00: failed command: READ FPDMA QUEUED\r\nata2.00: cmd 60\/78:e0:f0:70:77\/00:00:39:00:00\/40 tag 28 ncq 61440 in\r\nsd 1:0:0:0: [sdb] tag#25 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE\r\nsd 1:0:0:0: [sdb] tag#25 Sense Key : Illegal Request [current] [descriptor]\r\nsd 1:0:0:0: [sdb] tag#25 Add. Sense: Unaligned write command\r\n<\/pre>\n<\/li>\n<li>ZFS shows multiple disks are faulty. However their states become online after rebooting the system.<\/li>\n<\/ul>\n<p>If you are in any of these situations, there are multiple things you can do:<\/p>\n<p>If this is an important server and you don&#8217;t have any backup data, just wait. There is nothing you can do.<\/p>\n<p>If you have backup data, try to destroy the pool and rebuild again. The problem is that your Linux or ZFS does not like the current configurations. It is software rather than hardware issue. By rebuilding the entire zpool, everything will start over again. This will save you many days, weeks or even months of waiting time. In my situation, I had spent 2 months to resilver the data on my secondary backup server. After letting it to resilver for 2 months, I decided to rebuild the entire ZFS pool (using exact the same hardware) and loaded the data from my production server. It took less than a week to fill 50TB of data and the dmesg is clear of error message.<\/p>\n<p>Of course, sometimes the hard drive is faulty. We can perform a simple test with the following commands. First, try to link it to another server (or USB enclosure) and run the following (replace sdX with the actual hard drive identifier):<\/p>\n<pre>\r\nsudo smartctl -a \/dev\/sdX | grep result\r\n\r\n#Bad hard drive\r\nSMART overall-health self-assessment test result: FAILED!\r\n\r\n#Good hard drive\r\nSMART overall-health self-assessment test result: PASSED\r\n<\/pre>\n<p>Next, we perform a more intensive test. This will involve wiping your entire hard drive (writing data to every sector):<\/p>\n<pre>\r\nnohup sudo dd if=\/dev\/zero of=\/dev\/sdX bs=1M status=progress > dd.log &\r\n\r\n#This may take few days. You can check the progress this way:\r\nsudo tail dd.log\r\n<\/pre>\n<p>Once the process is done, try to run <code>dmesg | grep sdX<\/code>. If the hard drive is faulty, you will definitely see lots of error messages. In my case, pretty much all of the hard drives give no error. What does it mean? It means the ZFS system doesn&#8217;t like those hard drives. All I can say is that my ZFS is up and running (and error free) after rebuilding the entire pool, using  exact the same hard drives and cables.<\/p>\n<p>If you have tried this for multiple times but no luck, there is another thing you can try before dumping your hard drives: Switch to FreeBSD.<\/p>\n<p>I had a CentOS 7 server and I was having exact the same situations. I&#8217;ve wiped the disks and rebuilt the pool, and I couldn&#8217;t make the error go away. So I decided to switch to FreeBSD 12 (as of April, 2020), and I rebuilt the pool using exact the same specifications, and filled the pool with data. There was no error and the operation was extremely smooth. <\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you check your Zpool health status and you notice an error like the following: sudo zpool status pool: myzpool state: DEGRADED status: One or more devices are faulted in <a class=\"more-link\" href=\"https:\/\/icesquare.com\/wordpress\/zfs-on-linux-what-to-do-when-resilver-takes-very-long\/\">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":[177],"class_list":["post-4648","post","type-post","status-publish","format-standard","hentry","category-computer-problems-computer-help-pc-support","category-technology","category-zfs","tag-zfs"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p1sqzr-1cY","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":4830,"url":"https:\/\/icesquare.com\/wordpress\/zfshow-to-repair-a-zfs-pool-if-one-device-was-damaged\/","url_meta":{"origin":4648,"position":0},"title":"[ZFS]How to repair a ZFS pool if one device was damaged","author":"Derrick","date":"November 13, 2020","format":false,"excerpt":"Today, I accidentally dd'ed a disk which was part of an active ZFS pool on my test server. I dd'ed the first and the last 10 sectors of the disk. Technically I didn't lose any data because my ZFS configuration was RAIDZ. However once I rebooted my computer, my 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":3551,"url":"https:\/\/icesquare.com\/wordpress\/how-to-expand-zfs\/","url_meta":{"origin":4648,"position":1},"title":"How to Expand ZFS","author":"Derrick","date":"June 23, 2014","format":false,"excerpt":"Today I am going to share my story with you on how to expand my ZFS storage. I have a giant ZFS pool, which consists of 8x2TB (RAIDZ2) and 4x1.5TB (RAIDZ1), with a total of 15TB usable spaces. Since I am running out of space, I decide to upgrade the\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":2562,"url":"https:\/\/icesquare.com\/wordpress\/freebsd-9-zfs-one-or-more-devices-has-experienced-an-error-resulting-in-data-corruption-applications-may-be-affected\/","url_meta":{"origin":4648,"position":2},"title":"[FreeBSD+ZFS]One or more devices has experienced an error resulting in data corruption.  Applications may be affected.","author":"Derrick","date":"January 17, 2012","format":false,"excerpt":"When you check the ZFS status, you may find the following error message: One or more devices has experienced an error resulting in data corruption. Applications may be affected.. There can be million reasons to cause this error message showing up. Of course, 99% of them are caused by hardware\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":3743,"url":"https:\/\/icesquare.com\/wordpress\/zfs-performance-mirror-vs-raidz-vs-raidz2-vs-raidz3-vs-striped\/","url_meta":{"origin":4648,"position":3},"title":"ZFS Performance: Mirror VS RAIDZ VS RAIDZ2 vs RAIDZ3 vs Striped","author":"Derrick","date":"September 25, 2014","format":false,"excerpt":"I always wanted to find out the performance difference among different ZFS types, such as mirror, RAIDZ, RAIDZ2, RAIDZ3, Striped, two RAIDZ vdevs vs one RAIDZ2 vdev etc. So I decide to create an experiment to test these ZFS types. Before we talk about the test result, let's go over\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":3342,"url":"https:\/\/icesquare.com\/wordpress\/freebsd-zfs-faulted-kernel-ada0ahcich4000-lost-device\/","url_meta":{"origin":4648,"position":4},"title":"[FreeBSD] ZFS FAULTED \/ kernel: (ada0:ahcich4:0:0:0): lost device","author":"Derrick","date":"October 21, 2013","format":false,"excerpt":"I am so happy that I finally solved a problem today. This problem had existed in my server farms for few months already. In the past few months, I had absolutely no idea what was causing the issues. Here is my story: I built a file server using FreeBSD and\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":4648,"position":5},"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":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4648","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=4648"}],"version-history":[{"count":34,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4648\/revisions"}],"predecessor-version":[{"id":4756,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4648\/revisions\/4756"}],"wp:attachment":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/media?parent=4648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/categories?post=4648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/tags?post=4648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}