{"id":95,"date":"2014-11-06T22:04:56","date_gmt":"2014-11-06T14:04:56","guid":{"rendered":"http:\/\/blog.haostudio.net\/hwp\/?p=95"},"modified":"2017-07-25T00:20:18","modified_gmt":"2017-07-24T16:20:18","slug":"zfs-%e7%bd%ae%e6%8f%9b%e7%a1%ac%e7%a2%9f%e7%b4%80%e9%8c%84","status":"publish","type":"post","link":"https:\/\/blog.haostudio.net\/hwp\/zfs-%e7%bd%ae%e6%8f%9b%e7%a1%ac%e7%a2%9f%e7%b4%80%e9%8c%84\/","title":{"rendered":"ZFS \u7f6e\u63db\u786c\u789f\u7d00\u9304"},"content":{"rendered":"<!--more-->\n<h1>ZFS \u7f6e\u63db\u786c\u789f\u7d00\u9304<\/h1>\n<h2>\u767c\u751f\u60c5\u6cc1<\/h2>\n<p>\u7a81\u7136\u89ba\u5f97File Server \u901f\u5ea6\u7a81\u7136\u8b8a\u5f97\u5f88\u6162, \u9023\u4e0aServer \u770b\u4e00\u4e0bZFS \u7684\u72c0\u6cc1.<\/p>\n<pre><code># zpool status\n  pool: fspool\n state: ONLINE\n  scan: scrub repaired 0 in 18h19m with 0 errors on Mon Nov  3 21:04:18 2014\nconfig:\n\n    NAME        STATE     READ WRITE CKSUM\n    fspool      ONLINE       0     0     0\n      raidz1-0  ONLINE       0     0     0\n        ada0    ONLINE       0     0     0\n        ada1    ONLINE       0     0     0\n        ada2    ONLINE       0     0     0\n        ada3    ONLINE       0     0     0\n        ada5    ONLINE       0     0     0\n\nerrors: No known data errors\n<\/code><\/pre>\n<p>\u770b\u8d77\u4f86zpool \u662f\u6b63\u5e38\u7684\u554a.<\/p>\n<p>\u5f8c\u4f86\u67e5\u770b\u4e86\u4e00\u4e0b\/var\/log\/messages \u7d00\u9304, \u8d6b\u7136\u767c\u73feServer\u4e2d\u7684\u67d0\u500b\u786c\u789f\u5df2\u7d93\u767c\u751f\u4e86SMART error.<\/p>\n<pre><code># cat \/var\/log\/messages\nNov  6 15:16:45 hfs3 smartd[1373]: Device: \/dev\/ada1, FAILED SMART self-check. BACK UP DATA NOW!\nNov  6 15:16:45 hfs3 smartd[1373]: Device: \/dev\/ada1, Failed SMART usage Attribute: 5 Reallocated_Sector_Ct.\nNov  6 15:46:45 hfs3 smartd[1373]: Device: \/dev\/ada1, FAILED SMART self-check. BACK UP DATA NOW!\nNov  6 15:46:45 hfs3 smartd[1373]: Device: \/dev\/ada1, Failed SMART usage Attribute: 5 Reallocated_Sector_Ct.\nNov  6 16:16:45 hfs3 smartd[1373]: Device: \/dev\/ada1, FAILED SMART self-check. BACK UP DATA NOW!\nNov  6 16:16:45 hfs3 smartd[1373]: Device: \/dev\/ada1, Failed SMART usage Attribute: 5 Reallocated_Sector_Ct.\n<\/code><\/pre>\n<p>\u5929\u554a, \u786c\u789f\u5df2\u7d93\u5feb\u58de\u6389\u4e86, \u518d\u7528smartctl \u78ba\u8a8d\u4e00\u4e0b<\/p>\n<pre><code># smartctl -a \/dev\/ada1\nsmartctl 6.0 2012-10-10 r3643 [FreeBSD 9.1-RELEASE amd64] (local build)\nCopyright (C) 2002-12, Bruce Allen, Christian Franke, www.smartmontools.org\n\n=== START OF INFORMATION SECTION ===\nModel Family:     Seagate Barracuda LP\nDevice Model:     ST32000542AS\nSerial Number:    5XW1VR5F\nLU WWN Device Id: 5 000c50 02e7e8b9f\nFirmware Version: CC34\nUser Capacity:    2,000,398,934,016 bytes [2.00 TB]\nSector Size:      512 bytes logical\/physical\nRotation Rate:    5900 rpm\nDevice is:        In smartctl database [for details use: -P show]\nATA Version is:   ATA8-ACS T13\/1699-D revision 4\nSATA Version is:  SATA 2.6, 3.0 Gb\/s\nLocal Time is:    Thu Nov  6 20:32:47 2014 CST\n\n==&gt; WARNING: A firmware update for this drive may be available,\nsee the following Seagate web pages:\nhttp:\/\/knowledge.seagate.com\/articles\/en_US\/FAQ\/207931en\nhttp:\/\/knowledge.seagate.com\/articles\/en_US\/FAQ\/213915en\n\nSMART support is: Available - device has SMART capability.\nSMART support is: Enabled\n\n=== START OF READ SMART DATA SECTION ===\nSMART overall-health self-assessment test result: FAILED!\nDrive failure expected in less than 24 hours. SAVE ALL DATA.\nSee vendor-specific Attribute list for failed Attributes.\n\nGeneral SMART Values:\nOffline data collection status:  (0x00) Offline data collection activity\n                    was never started.\n                    Auto Offline Data Collection: Disabled.\nSelf-test execution status:      (   0) The previous self-test routine completed\n                    without error or no self-test has ever \n                    been run.\nTotal time to complete Offline \ndata collection:        (  633) seconds.\nOffline data collection\ncapabilities:            (0x73) SMART execute Offline immediate.\n                    Auto Offline data collection on\/off support.\n                    Suspend Offline collection upon new\n                    command.\n                    No Offline surface scan supported.\n                    Self-test supported.\n                    Conveyance Self-test supported.\n                    Selective Self-test supported.\nSMART capabilities:            (0x0003) Saves SMART data before entering\n                    power-saving mode.\n                    Supports SMART auto save timer.\nError logging capability:        (0x01) Error logging supported.\n                    General Purpose Logging supported.\nShort self-test routine \nrecommended polling time:    (   1) minutes.\nExtended self-test routine\nrecommended polling time:    ( 453) minutes.\nConveyance self-test routine\nrecommended polling time:    (   2) minutes.\nSCT capabilities:          (0x103f) SCT Status supported.\n                    SCT Error Recovery Control supported.\n                    SCT Feature Control supported.\n                    SCT Data Table supported.\n\nSMART Attributes Data Structure revision number: 10\nVendor Specific SMART Attributes with Thresholds:\nID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE\n  1 Raw_Read_Error_Rate     0x000f   119   099   006    Pre-fail  Always       -       204814378\n  3 Spin_Up_Time            0x0003   100   100   000    Pre-fail  Always       -       0\n  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       73\n  5 Reallocated_Sector_Ct   0x0033   003   003   036    Pre-fail  Always   FAILING_NOW 3974\n  7 Seek_Error_Rate         0x000f   088   060   030    Pre-fail  Always       -       681344031\n  9 Power_On_Hours          0x0032   062   062   000    Old_age   Always       -       34092\n 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0\n 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       73\n183 Runtime_Bad_Block       0x0032   099   099   000    Old_age   Always       -       1\n184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0\n187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0\n188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0\n189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0\n190 Airflow_Temperature_Cel 0x0022   064   056   045    Old_age   Always       -       36 (Min\/Max 35\/42)\n194 Temperature_Celsius     0x0022   036   044   000    Old_age   Always       -       36 (0 23 0 0 0)\n195 Hardware_ECC_Recovered  0x001a   046   027   000    Old_age   Always       -       204814378\n197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0\n198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0\n199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0\n240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       225292509545553\n241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       4046415663\n242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       1941661744\n\nSMART Error Log Version: 1\nNo Errors Logged\n\nSMART Self-test log structure revision number 1\nNo self-tests have been logged.  [To run self-tests, use: smartctl -t]\n\nSMART Selective self-test log data structure revision number 1\n SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS\n    1        0        0  Not_testing\n    2        0        0  Not_testing\n    3        0        0  Not_testing\n    4        0        0  Not_testing\n    5        0        0  Not_testing\nSelective self-test flags (0x0):\n  After scanning selected spans, do NOT read-scan remainder of disk.\nIf Selective self-test is pending on power-up, resume after 0 minute delay.\n<\/code><\/pre>\n<p>\u7684\u78ba, HDD ada1 \u7684SMART Attributes\n<em>Reallocated&#095;Sector&#095;Ct<\/em> \u5df2\u7d93\u51fa\u554f\u984c\u4e86. \u8d95\u7dca\u4e0a\u7db2\u53bb\u8a02\u4e86\u4e00\u9846\u786c\u789f, \u6e96\u5099\u66ff\u63db.<\/p>\n<p>\u901a\u5e38SMRT \u56de\u5831\u932f\u8aa4\u7684\u6642\u5019, \u4e26\u4e0d\u4e00\u5b9a\u786c\u789f\u7684\u8cc7\u6599\u6703\u7acb\u523b\u640d\u6bc0, \u4f46\u662f\u901a\u5e38\u9019\u786c\u789f\u4e5f\u6d3b\u4e0d\u4e45\u4e86. \u9084\u597d, \u786c\u789f\u7684\u8cc7\u6599\u9084\u6c92\u640d\u6bc0, \u5373\u4f7f\u662f\u640d\u6bc0\u4e86, \u6709Raidz \u4fdd\u8b77, \u61c9\u8a72\u9084\u53ef\u6490\u5e7e\u5929\u6c92\u554f\u984c\u5427.<\/p>\n<hr \/>\n<h2>Replace HDD<\/h2>\n<p>\u7d42\u65bc\u62ff\u5230\u65b0\u786c\u789f\u5230\u4e86.  \u55ef, \u6e96\u5099\u52d5\u624b\u66ff\u63db.<\/p>\n<p>\u9996\u5148, \u5148\u5c07\u6709\u554f\u984c\u7684HDD \u505a\u96e2\u7dda\u52d5\u4f5c.<\/p>\n<pre><code># zpool offline fspool ada1\n1. zpool status\n  pool: fspool\n state: DEGRADED\nstatus: One or more devices has been taken offline by the administrator.\n    Sufficient replicas exist for the pool to continue functioning in a\n    degraded state.\naction: Online the device using &#039;zpool online&#039; or replace the device with\n    &#039;zpool replace&#039;.\n  scan: scrub repaired 0 in 18h19m with 0 errors on Mon Nov  3 21:04:18 2014\nconfig:\n\n    NAME                      STATE     READ WRITE CKSUM\n    fspool                    DEGRADED     0     0     0\n      raidz1-0                DEGRADED     0     0     0\n        ada0                  ONLINE       0     0     0\n        11298317341861346220  OFFLINE      0     0     0  was \/dev\/ada1\n        ada2                  ONLINE       0     0     0\n        ada3                  ONLINE       0     0     0\n        ada5                  ONLINE       0     0     0\n\nerrors: No known data errors\n<\/code><\/pre>\n<p>\u9019\u6642fspool \u5df2\u7d93\u7d93\u5165\n<em>DEGRADED<\/em> \u72c0\u614b, \u9019\u500b\u72c0\u614b\u8868\u793a\u9019\u500bzpool \u96d6\u7136\u9084\u80fd\u904b\u4f5c, \u4f46\u662f\u8655\u65bc\u5371\u96aa\u72c0\u614b.\n\u539f\u4f86\u7684ada1 \u540d\u5b57\u88ab\u63db\u6210\n<em>11298317341861346220<\/em>, \u5148\u8a18\u4e0b\u9019\u500b\u503c, \u7b49\u6703\u7f6e\u63db\u6642\u6703\u7528\u5230.<\/p>\n<p>\u8d95\u7dca\u5c07\u554f\u984c\u786c\u789f\u62d4\u51fa, \u518d\u63db\u4e0a\u65b0\u786c\u789f. \u5148\u7528smartctl \u78ba\u8a8d\u65b0\u786c\u789f\u662f\u5426ok.<\/p>\n<pre><code># smartctl -a \/dev\/ada1\nsmartctl 6.0 2012-10-10 r3643 [FreeBSD 9.1-RELEASE amd64] (local build)\nCopyright (C) 2002-12, Bruce Allen, Christian Franke, www.smartmontools.org\n\n=== START OF INFORMATION SECTION ===\nDevice Model:     TOSHIBA DT01ACA300\nSerial Number:    84MBWPHGS\nLU WWN Device Id: 5 000039 ff4e1970c\nFirmware Version: MX6OABB0\nUser Capacity:    3,000,592,982,016 bytes [3.00 TB]\nSector Sizes:     512 bytes logical, 4096 bytes physical\nRotation Rate:    7200 rpm\nDevice is:        Not in smartctl database [for details use: -P showall]\nATA Version is:   ATA8-ACS T13\/1699-D revision 4\nSATA Version is:  SATA 3.0, 6.0 Gb\/s (current: 3.0 Gb\/s)\nLocal Time is:    Thu Nov  6 20:46:33 2014 CST\nSMART support is: Available - device has SMART capability.\nSMART support is: Enabled\n\n=== START OF READ SMART DATA SECTION ===\nSMART overall-health self-assessment test result: PASSED\n\nGeneral SMART Values:\nOffline data collection status:  (0x80) Offline data collection activity\n                    was never started.\n                    Auto Offline Data Collection: Enabled.\nSelf-test execution status:      (   0) The previous self-test routine completed\n                    without error or no self-test has ever \n                    been run.\nTotal time to complete Offline \ndata collection:        (21791) seconds.\nOffline data collection\ncapabilities:            (0x5b) SMART execute Offline immediate.\n                    Auto Offline data collection on\/off support.\n                    Suspend Offline collection upon new\n                    command.\n                    Offline surface scan supported.\n                    Self-test supported.\n                    No Conveyance Self-test supported.\n                    Selective Self-test supported.\nSMART capabilities:            (0x0003) Saves SMART data before entering\n                    power-saving mode.\n                    Supports SMART auto save timer.\nError logging capability:        (0x01) Error logging supported.\n                    General Purpose Logging supported.\nShort self-test routine \nrecommended polling time:    (   1) minutes.\nExtended self-test routine\nrecommended polling time:    ( 364) minutes.\nSCT capabilities:          (0x003d) SCT Status supported.\n                    SCT Error Recovery Control supported.\n                    SCT Feature Control supported.\n                    SCT Data Table supported.\n\nSMART Attributes Data Structure revision number: 16\nVendor Specific SMART Attributes with Thresholds:\nID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE\n  1 Raw_Read_Error_Rate     0x000b   100   100   016    Pre-fail  Always       -       0\n  2 Throughput_Performance  0x0005   100   100   054    Pre-fail  Offline      -       0\n  3 Spin_Up_Time            0x0007   100   100   024    Pre-fail  Always       -       0\n  4 Start_Stop_Count        0x0012   100   100   000    Old_age   Always       -       1\n  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0\n  7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail  Always       -       0\n  8 Seek_Time_Performance   0x0005   100   100   020    Pre-fail  Offline      -       0\n  9 Power_On_Hours          0x0012   100   100   000    Old_age   Always       -       0\n 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail  Always       -       0\n 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       1\n192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       1\n193 Load_Cycle_Count        0x0012   100   100   000    Old_age   Always       -       1\n194 Temperature_Celsius     0x0002   214   214   000    Old_age   Always       -       28 (Min\/Max 25\/28)\n196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0\n197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0\n198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0\n199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age   Always       -       0\n\nSMART Error Log Version: 1\nNo Errors Logged\n\nSMART Self-test log structure revision number 1\nNo self-tests have been logged.  [To run self-tests, use: smartctl -t]\n\nSMART Selective self-test log data structure revision number 1\n SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS\n    1        0        0  Not_testing\n    2        0        0  Not_testing\n    3        0        0  Not_testing\n    4        0        0  Not_testing\n    5        0        0  Not_testing\nSelective self-test flags (0x0):\n  After scanning selected spans, do NOT read-scan remainder of disk.\nIf Selective self-test is pending on power-up, resume after 0 minute delay\n<\/code><\/pre>\n<p>\u770b\u4f86\u662fok\u7684, \u63a5\u4e0b\u4f86\u5c31\u662f\u8b93\u65b0\u786c\u789f online \u56c9. \u4f7f\u7528zpool replace \u547d\u4ee4\u7f6e\u63db.<\/p>\n<pre><code># zpool replace fspool 11298317341861346220 ada1\n<\/code><\/pre>\n<p>\u4e0a\u9762\u90a3\u500b\n<em>11298317341861346220<\/em> \u5c31\u662f\u525b\u525b\u8a18\u4e0b\u4f86\u7684\u90a3\u500b\u503c.<\/p>\n<p>\u518d\u6aa2\u67e5\u4e00\u4e0bzpool \u72c0\u614b<\/p>\n<pre><code># zpool status\n  pool: fspool\n state: DEGRADED\nstatus: One or more devices is currently being resilvered.  The pool will\n    continue to function, possibly in a degraded state.\naction: Wait for the resilver to complete.\n  scan: resilver in progress since Thu Nov  6 20:47:24 2014\n        550G scanned out of 7.44T at 144M\/s, 13h56m to go\n        107G resilvered, 7.22% done\nconfig:\n\n    NAME                        STATE     READ WRITE CKSUM\n    fspool                      DEGRADED     0     0     0\n      raidz1-0                  DEGRADED     0     0     0\n        ada0                    ONLINE       0     0     0\n        replacing-1             OFFLINE      0     0     0\n          11298317341861346220  OFFLINE      0     0     0  was \/dev\/ada1\/old\n          ada1                  ONLINE       0     0     0  (resilvering)\n        ada2                    ONLINE       0     0     0\n        ada3                    ONLINE       0     0     0\n        ada5                    ONLINE       0     0     0\n\nerrors: No known data errors\n<\/code><\/pre>\n<p>\u55ef, \u6b63\u5728\u91cd\u65b0\u639b\u8f09\u4e2d, \u770b\u4f86\u8981\u7b49\u5230\u660e\u5929, zpool \u7684\u72c0\u614b\u624d\u6703\u7531DEGRADED \u56de\u5fa9\u5230 ONLINE \u72c0\u614b. \u5728\u9019\u6bb5\u671f\u9593ZFS \u9084\u662f\u80fd\u5920\u904b\u4f5c\u5594. \u9084\u662f\u53ef\u4ee5\u7e7c\u7e8c\u64cd\u5b83\u5594.<\/p>\n<hr \/>\n<h3>\u53c3\u8003\u8cc7\u6599<\/h3>\n<ol>\n<li><a href=\"http:\/\/wiki.nas4free.org\/doku.php?id=faq:0149\">How do I remove \/ replace a failed disk in a ZFS array<\/a><\/li>\n<li><a href=\"http:\/\/docs.oracle.com\/cd\/E19253-01\/819-5461\/6n7ht6r7p\/index.html\">Replacing a Device in a ZFS Storage Pool<\/a><\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[18],"class_list":["post-95","post","type-post","status-publish","format-standard","hentry","category-zfs-2","tag-zfs"],"_links":{"self":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":3,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":409,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/95\/revisions\/409"}],"wp:attachment":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}