zpool维护操作实例

参考此处进行zil设备的添加,后来HDTUNE测试该设备性能时损坏了数据

报错:

tank unavailable....FAULTED...

处理:

zpool clear tank c5t1d0s0
zpool status -x
zpool remove tank  c5t1d0s0
zpool remove tank  c5t1d0s1
zpool status -v
zpool list

  • 替换zpool Raidz3 中坏掉的一个硬盘;
# offline 坏盘
zpool offline tank /dev/disk/by-id/ata-ST3000DM001-1ER166_Wxxxx
# 替换新盘
zpool replace -f tank /dev/disk/by-id/ata-ST3000DM001-1ER166_W50144XH /dev/disk/by-id/ata-ST3000DM001-1ER166_W501Y62S
# 在此查看状态,已经开始replacing了
zpool status -v

resilvering:

  pool: tank
 state: DEGRADED
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Wed Dec  6 17:41:22 2017
    116G scanned out of 21.6T at 624M/s, 10h2m to go
    4.74G resilvered, 0.53% done
config:

        NAME                                   STATE     READ WRITE CKSUM
        tank                                   DEGRADED     0     0     0
 ...
            replacing-6                        OFFLINE      0     0     0
              14721783078452005034             OFFLINE      0     0     0  was /dev/disk/by-id/ata-ST3000DM001-1ER166_W50144XH-part1
              ata-ST3000DM001-1ER166_Wxxxxx  ONLINE       0     0     0  (resilvering)
...

errors: No known data errors

resilvered:

  pool: tank
 state: ONLINE
  scan: resilvered 903G in 6h45m with 0 errors on Thu Dec  7 00:26:50 2017
...

某次换盘的时候,拔错盘了,造成很多文件损失,完成维护后,zpool status -v一直有replacing的状态,处理:

zpool detach tank 8914685750264499217(old_disk)

由于误拔了一块zpool的磁盘,导致zpool DEGRADE.

被误拔的磁盘状态变为UNAVAIL:

由于不是磁盘本身的故障而是误拔,所以不需要zpool replace:

zpool online tank ata-HGST_HUS726040ALE610_N8Gxxxx

online后的状态,显示磁盘已经scrub了一些数据:


可以使用 zpool import -D 命令恢复已销毁的pool:

# 误操作destroy了pool
zpool destroy tank
 
# 第一次执行,输出中state: ONLINE (DESTROYED),因此可以将池 tank 确定为已销毁的池:
zpool import -D
 
# 要恢复已销毁的池,请再次执行 zpool import -D 命令,并指定要恢复的池:
zpool import -D tank

如果已销毁池中的某个设备出现故障或不可用,通过添加 -f 也许能够恢复已销毁的池。

在此情况下,请导入已降级的池,然后尝试修复设备故障。例如:

# 第一次执行导入,确认被destroy的pool
zpool import -D
# 强制导入降级的pool
zpool import -Df dozer
# 查看健康状态,有故障
zpool status -x
 
....
 state: DEGRADED
...
...
            c2t11d0  UNAVAIL      0    37     0  cannot open
...
 
# 重新online故障设备
zpool online dozer c2t11d0
# 再次查看pool状态
zpool status -x

  • storage/zfs/zpool维护操作实例.txt
  • 最后更改: 2019/09/19 20:54
  • 由 mrco