我还是 ZFS 的新手。我们的 ZFS 池中有一个故障磁盘(使用 Ubuntu 22.04.2.LTS)。它已被自动替换为备用磁盘(我尝试仅引用相关部分):
zpool status ZFS
pool: ZFS
state: DEGRADED
...
raidz1-2 DEGRADED 0 0 0
wwn-0x5000039c48513d8d ONLINE 0 0 0
spare-1 DEGRADED 0 0 0
wwn-0x5000039c48512f59 UNAVAIL 4 128 0
wwn-0x5000039c48508ee1 ONLINE 0 0 0
...
spares
wwn-0x5000039c48508ee1 INUSE currently in use
errors: No known data errors
我分离了有故障的备用磁盘,然后更换了物理磁盘:
zpool detach ZFS wwn-0x5000039c48512f59
现在看来还可以:
zpool status ZFS
pool: ZFS
state: ONLINE
scan: resilvered 826G in 01:40:08 with 0 errors on Thu May 2 00:18:18 2024
config:
NAME STATE READ WRITE CKSUM
ZFS ONLINE 0 0 0
...
raidz1-2 ONLINE 0 0 0
wwn-0x5000039c48513d8d ONLINE 0 0 0
wwn-0x5000039c48508ee1 ONLINE 0 0 0
wwn-0x5000039c48513d35 ONLINE 0 0 0
wwn-0x5000039c48510189 ONLINE 0 0 0
wwn-0x5000039c48516f0d ONLINE 0 0 0
logs
wwn-0x5002538022c12e30 ONLINE 0 0 0
cache
wwn-0x5002538022c12d70 ONLINE 0 0 0
errors: No known data errors
剩下的任务是添加新磁盘作为备用磁盘,但如何确定要添加的正确磁盘:
zpool add -f ZFS 备用(磁盘)
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
...
sdj 8:144 0 7.3T 0 disk
├─sdj1 8:145 0 7.3T 0 part
└─sdj9 8:153 0 8M 0 part
sdk 8:160 0 7.3T 0 disk
├─sdk1 8:161 0 7.3T 0 part
└─sdk9 8:169 0 8M 0 part
sdl 8:176 0 7.3T 0 disk
sdm 8:192 0 7.3T 0 disk
├─sdm1 8:193 0 7.3T 0 part
└─sdm9 8:201 0 8M 0 part
...
ls -al /dev/disk/by-id/|grep sdl
lrwxrwxrwx 1 root root 9 May 13 12:46 scsi-35000c500f8025907 -> ../../sdl
lrwxrwxrwx 1 root root 9 May 13 12:46 scsi-SSEAGATE_ST8000NM024B_WWZ51SS9 -> ../../sdl
lrwxrwxrwx 1 root root 9 May 13 12:46 wwn-0x5000c500f8025907 -> ../../sdl
我的推理是否正确,因为 sdl 是唯一未分区或未连接到任何 LVM 等的磁盘,所以它必须是新的替换磁盘,我应该将其添加为备用磁盘:
zpool add -f ZFS spare wwn-0x5000c500f8025907
或者我应该尝试以某种方式仔细检查这一点,例如检查 sdl 是否确实不包含任何数据或正在使用(如何?),是否可以在 syslog 或 blkid 中看到该磁盘是最近添加的,等等?
当然,我应该在磁盘交换之前检查这些事情,例如不可用的 wwn 指向哪个磁盘等,但我一直在学习这些事情......
您可能正在寻找
zpool status -L
,尝试一下。