zpool replace のディスク交換を中断2018年04月08日 07時57分21秒

ZFS でディスクを交換するときは、zpool replace pool old-device new-device で始める。そうすると、resilver が始まり、データの移行が進められる。

何らかの理由により、ディスクの交換を中断したいときがある。そんな時は、zpool detach pool new-deviceで中断できる。

$ zpool status
  pool: scratch
 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 Thu Apr  5 23:54:13 2018
        959G scanned out of 2.35T at 11.4M/s, 36h6m to go
        458G resilvered, 39.83% done
config:


        NAME                                    STATE     READ WRITE CKSUM
        zfs                                     DEGRADED     1     0   453
          raidz1-0                              DEGRADED     1     0 1.62K
            gpt/zfs1                            ONLINE       0     0     0
            replacing-1                         ONLINE       0     0   106
              gpt/zfs2                          ONLINE       2     0     0  (resilvering)
              gpt/zfs6                          ONLINE       0     0     0  (resilvering)
            gpt/zfs3                            ONLINE       1     0     0  (resilvering)
            replacing-3                         DEGRADED     2     0     0
              15470053991832379715              UNAVAIL      0     0     0  was
/dev/gpt/zfs4
              gpt/zfs5                          ONLINE       2     0     0  (resilvering)


$ zpool detach scratch /dev/gpt/zfs6
$ zpool status
  pool: scratch
 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 Thu Apr  5 23:54:13 2018
        961G scanned out of 2.35T at 11.4M/s, 36h5m to go
        458G resilvered, 39.83% done
config:


        NAME                                    STATE     READ WRITE CKSUM
        zfs                                     DEGRADED     1     0   453
          raidz1-0                              DEGRADED     1     0 1.62K
            gpt/zfs1                            ONLINE       0     0     0
            gpt/zfs2                            ONLINE       2     0     0  (resilvering)
ering)
            gpt/zfs3                            ONLINE       1     0     0  (resilvering)
            replacing-3                         DEGRADED     2     0     0
              15470053991832379715              UNAVAIL      0     0     0  was
/dev/gpt/zfs4
              gpt/zfs5                          ONLINE       2     0     0  (resilvering)
resilver が発生していたディスクはそのまま作業が進められるようだ。