我无法从 zfs 池中删除“坏”磁盘

Mik*_*kov 5 zfs

  1. 池中有 2 个磁盘 /dev/sde /dev/sdf

  2. 磁盘 /dev/sde 已损坏,我将其从池中排除并用新磁盘替换。袭击已经降级。

  3. 将新的 /dev/sde 磁盘添加到池后,我得到了以下配置:

 zpool status
  pool: rpool
 state: DEGRADED
status: One or more devices could not be used because the label is missing or
        invalid.  Sufficient replicas exist for the pool to continue
        functioning in a degraded state.
action: Replace the device using 'zpool replace'.
   see: http://zfsonlinux.org/msg/ZFS-8000-4J
  scan: scrub repaired 0B in 0h25m with 0 errors on Wed Sep  2 18:32:39 2020
config:

        NAME        STATE     READ WRITE CKSUM
        rpool       DEGRADED     0     0     0
          mirror-0  DEGRADED     0     0     0
            old     UNAVAIL      0     0     0
            sdf2    ONLINE       0     0     0
          sde2      ONLINE       0     0     0
Run Code Online (Sandbox Code Playgroud)

替换、离线、删除“旧”总是报错:

zpool replace rpool old

cannot open 'old': no such device in /dev

must be a full path or shorthand device name
Run Code Online (Sandbox Code Playgroud)

在文件 /etc/zfs/zpool.cache 中我看到驱动器 /dev/sde2/old

如何在不重启服务器和删除阵列(阵列为/)的情况下移除旧磁盘?


root@v05:/# zpool replace rpool old sde2
invalid vdev specification
use '-f' to override the following errors:
/dev/sde2 is part of active pool 'rpool'

root@v05:/# zpool replace -f rpool old sde2
invalid vdev specification
the following errors must be manually repaired:
/dev/sde2 is part of active pool 'rpool'
Run Code Online (Sandbox Code Playgroud)

sde 已经是 rpool 成员。

需要从池中删除旧的(/dev/sde/old)磁盘。

添加新磁盘时没有错误,一切都完全按照您所写的进行。

sho*_*hok 2

您在添加新磁盘时可能犯了一个错误:您发出了zpool add rpool <newdisk>,但您必须更换出现故障的磁盘。换句话说,您必须:

  • zpool replace rpool <olddisk> <newdisk>
  • zpool detach rpool <olddisk>; zpool attach rpool sdfsdf是另一个镜腿)。

请注意我是如何编写的attach,而您可能add在 zpool 命令中使用过。

你如何解决这个问题?对于 ZFS 0.7.x,您就不走运了,因为添加数据 vdev 后无法删除。使用ZFS 0.8.x,您可以将其删除,因此,如果您运行的是 ZFS 0.7.x,则第一步需要更新到 0.8.x。然后您必须发出上述命令来更换故障磁盘。