写在前面

有的时候服务器异常断电后Scrub,虽然会将错误修复,但DEGRADED标识却会一直存在,导致我看的很不舒服

  pool: TN-NAS Backup
 state: DEGRADED
  scan: scrub repaired 0B in 02:56:14 with 0 errors on Sat Jul 20 17:13:56 2024
config:

        NAME                                      STATE     READ WRITE CKSUM
        TN-NAS Backup                             DEGRADED     0     0     0
          raidz1-0                                DEGRADED     0     0     0
            a908ac52-f760-48d5-948e-d24cccd06bd8  DEGRADED     0     0     0  too many errors
            382e28a0-5ae5-43dd-9ab2-cc6b3e9a3984  ONLINE       0     0     0
            84d5ef51-8006-4fd9-84f5-aa54fb8aa050  ONLINE       0     0     0
            aa73d953-717d-4d95-9c72-2c0db3390959  ONLINE       0     0     0

errors: No known data errors

如上所示,然而实际上坏块是已经被修复,在确保坏块已经被修复的前提下,我们可以清除该提示

一、定位坏块位置

输入以下指令

zpool status

你将得到以下返回(该返回为正常情况下的返回,如果有异常将会是上面的返回)

root@truenas[~]# zpool status
  pool: TN-NAS
 state: ONLINE
  scan: scrub repaired 0B in 05:51:25 with 0 errors on Wed Jul 10 08:46:44 2024
config:

        NAME                                      STATE     READ WRITE CKSUM
        TN-NAS                                    ONLINE       0     0     0
          raidz2-0                                ONLINE       0     0     0
            35be0c92-30fc-4deb-9166-c001ef8962b7  ONLINE       0     0     0
            3ddd0199-8a8d-476a-a5db-0701b860679d  ONLINE       0     0     0
            3d5530e8-d7a2-48ca-b0e1-2a8af85d988e  ONLINE       0     0     0
            f851acd6-19c7-47c6-90af-6ec70ede3f90  ONLINE       0     0     0
            8a70e407-bcd6-42ba-a6a6-ee5c91ff75ff  ONLINE       0     0     0
            faa6f4f4-a6bb-46e1-958f-ac24231f02bb  ONLINE       0     0     0
        logs
          80894a58-1d90-410f-b2b7-bcc84f7c3b1b    ONLINE       0     0     0
        cache
          8b668abc-707c-4c23-9e3c-03cd7429aa72    ONLINE       0     0     0
        spares
          ee03f40e-0460-4835-9562-8534b8ae5355    AVAIL   
          bbf85539-c4b3-4b5d-acb4-e50b73a72b05    AVAIL   

errors: No known data errors

二、清除磁盘错误信息

输入以下指令,将我的TN-NAS\ Backup替换成你的pool名,a908ac52-f760-48d5-948e-d24cccd06bd8替换成你的磁盘ID

zpool clear TN-NAS\ Backup a908ac52-f760-48d5-948e-d24cccd06bd8

三、手动执行一次Scrub(可跳过)

输入以下指令,将我的TN-NAS\ Backup替换成你的pool名

zpool scrub TN-NAS\ Backup