![zfs 删除错误添加的设备](https://linux22.com/image/754338/zfs%20%E5%88%A0%E9%99%A4%E9%94%99%E8%AF%AF%E6%B7%BB%E5%8A%A0%E7%9A%84%E8%AE%BE%E5%A4%87.png)
我意外地将设备添加为普通池设备而不是缓存设备。有办法撤消此操作吗?(我基本上忘记cache
在添加设备时输入了)
我无法删除它
root@dmi-vault2:~# zpool remove tank ata-INTEL_SSDSC2BA100G3_BTTV24540538100FGN-part2
cannot remove ata-INTEL_SSDSC2BA100G3_BTTV24540538100FGN-part2: only inactive hot spares, cache, or log devices can be removed
我无法将其拆下
root@dmi-vault2:~# zpool detach tank ata-INTEL_SSDSC2BA100G3_BTTV24540538100FGN-part2
cannot detach ata-INTEL_SSDSC2BA100G3_BTTV24540538100FGN-part2: only applicable to mirror and replacing vdevs
另外我不能仅仅将其添加为缓存
root@dmi-vault2:~# zpool add tank cache ata-INTEL_SSDSC2BA100G3_BTTV24540538100FGN-part2 -f
invalid vdev specification
the following errors must be manually repaired:
/dev/disk/by-id/ata-INTEL_SSDSC2BA100G3_BTTV24540538100FGN-part2 is part of active pool 'tank'
这就是我的游泳池现在的样子。感兴趣的是ata-INTEL_SSDSC2BA100G3_BTTV24540538100FGN-part2 DEGRADED 0 0 0 external
root@dmi-vault2:~# zpool status
pool: tank
state: DEGRADED
status: One or more devices has experienced an unrecoverable error. An
attempt was made to correct the error. Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
using 'zpool clear' or replace the device with 'zpool replace'.
see: http://zfsonlinux.org/msg/ZFS-8000-9P
scan: scrub repaired 0B in 22h29m with 0 errors on Mon Jun 29 05:17:12 2020
config:
NAME STATE READ WRITE CKSUM
tank DEGRADED 0 0 0
raidz3-0 ONLINE 0 0 0
wwn-0x5000cca098c6e83f ONLINE 0 0 0
wwn-0x5000cca098c6ddb1 ONLINE 0 0 0
wwn-0x5000cca098cadb96 ONLINE 0 0 0
wwn-0x5000cca098c9bdeb ONLINE 0 0 0
wwn-0x5000cca098ca921b ONLINE 0 0 0
wwn-0x5000cca098cadb0f ONLINE 0 0 0
wwn-0x5000cca098cab2aa ONLINE 0 0 0
wwn-0x5000cca098ca7e77 ONLINE 0 0 0
wwn-0x5000cca098ca9275 ONLINE 0 0 0
wwn-0x5000cca098ca9116 ONLINE 0 0 0
wwn-0x5000cca098cad20c ONLINE 0 0 0
wwn-0x5000cca098ca91b3 ONLINE 0 0 0
wwn-0x5000cca098cab248 ONLINE 0 0 0
wwn-0x5000cca098c2c3d9 ONLINE 0 0 0
raidz3-1 ONLINE 0 0 0
wwn-0x5000cca23de10b98 ONLINE 0 0 0
wwn-0x5000cca23de204aa ONLINE 0 0 0
wwn-0x50014ee20898b856 ONLINE 0 0 0
wwn-0x5000cca23ddf44a5 ONLINE 0 0 0
wwn-0x5000cca23de15a2c ONLINE 0 0 0
wwn-0x50014ee208947306 ONLINE 0 0 0
wwn-0x5000cca23dec3f07 ONLINE 0 0 0
wwn-0x5000cca23de1b8d3 ONLINE 0 0 0
wwn-0x5000cca23ddf91c1 ONLINE 0 0 0
wwn-0x5000cca23ddd65f1 ONLINE 0 0 0
wwn-0x5000cca23ddf0a14 ONLINE 0 0 0
wwn-0x5000cca23ddd65d2 ONLINE 0 0 0
wwn-0x5000cca23ddf424d ONLINE 0 0 0
wwn-0x5000cca23ddd6109 ONLINE 0 0 0
raidz3-2 ONLINE 0 0 0
wwn-0x5000cca098c1f945 ONLINE 0 0 0
wwn-0x5000cca098c20eb4 ONLINE 0 0 0
wwn-0x5000cca098c20909 ONLINE 0 0 0
wwn-0x5000cca098c24661 ONLINE 0 0 0
wwn-0x5000cca098c20d3d ONLINE 0 0 0
wwn-0x5000cca098c1f2ef ONLINE 0 0 0
wwn-0x5000cca098c208f3 ONLINE 0 0 0
wwn-0x5000cca098c23e41 ONLINE 0 0 0
wwn-0x5000cca098c2063c ONLINE 0 0 0
wwn-0x5000cca098c20784 ONLINE 0 0 0
wwn-0x5000cca098c1f6b5 ONLINE 0 0 0
wwn-0x5000cca098c20087 ONLINE 0 0 0
wwn-0x5000cca098c20925 ONLINE 0 0 0
wwn-0x5000cca098c257bd ONLINE 0 0 0
ata-INTEL_SSDSC2BA100G3_BTTV24540538100FGN-part2 DEGRADED 0 0 0 external device fault
logs
ata-INTEL_SSDSC2BA100G3_BTTV24540538100FGN-part1 ONLINE 0 0 0
spares
sdaj FAULTED corrupted data
sdak FAULTED corrupted data
sdaq FAULTED corrupted data
errors: No known data errors
答案1
不幸的是,简短的回答是不,你不能移除这样的设备。
ZFS < 0.8.x 根本不支持删除非缓存/slog vdev,而 0.8.x 支持有限的 vdev 删除,这将不是满足你的需求,因为它不适用于 RAIDZ vdevs。
测试池示例:
[root@localhost test]# zpool status zzz
pool: zzz
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
zzz ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
/root/test/disk1 ONLINE 0 0 0
/root/test/disk2 ONLINE 0 0 0
/root/test/disk3 ONLINE 0 0 0
/root/test/disk4 ONLINE 0 0 0
errors: No known data errors
[root@localhost test]# zpool remove zzz /root/test/disk4
cannot remove /root/test/disk4: invalid config; all top-level vdevs must have the same sector size and not be raidz.
对不起,我能感受到痛苦……