Permalink: 2012-05-02 23:05:00+09:00 by ruy@ainoniwa.net in technical tags: FreeBSD FS HDD ZFS social:

1TB*5台で構成されているRAIDZの空き容量が不足しているので、全部2TBに交換してオンラインマイグレーションする。

zpoolのオンラインマイグレーションは、

  • zpoolのautoexpandプロパティを使用する
  • zpool online -e を使用する

の2パターンがあるが、FreeBSD 8.2(zpool v15)以前では使用出来ず再起動したので、実際は「オンラインマイグレーションする予定でした。」が正しい。

その一部ログを単に貼り付けるだけですよ、っと。

現在の接続状況

# camcontrol devlist -v
scbus0 on mpt0 bus 0:
<ATA WDC WD10EADS-00L 1A01>        at scbus0 target 0 lun 0 (da0,pass0)
<ATA ST2000DL003-9VT1 CC3C>        at scbus0 target 1 lun 0 (da1,pass1)
<ATA Hitachi HDS5C302 A580>        at scbus0 target 2 lun 0 (da2,pass2)
<ATA Hitachi HDS72202 A28A>        at scbus0 target 3 lun 0 (da3,pass3)
<>                                 at scbus0 target -1 lun -1 ()
scbus1 on mpt0 bus 1:
<>                                 at scbus1 target -1 lun -1 ()
scbus-1 on xpt0 bus 0:
<>                                 at scbus-1 target -1 lun -1 (xpt0)
# zpool status lib_01

  pool: lib_01
 state: ONLINE
 scrub: resilver completed after 13h42m with 0 errors on Fri Apr 27 10:13:08 2012
config:

NAME        STATE     READ WRITE CKSUM
lib_01      ONLINE       0     0     0
  raidz1    ONLINE       0     0     0
    ad10    ONLINE       0     0     0  900G resilvered
    ad8     ONLINE       0     0     0
    ad6     ONLINE       0     0     0
    da0     ONLINE       0     0     0
    ad12    ONLINE       0     0     0

errors: No known data errors

対象をda0(scbus0 target 0 lun 0)に決定。

通常、camcontrolでdeviceを外す場合はejectを使用するが、今回はデバイスがejectを受け付けない。

# camcontrol eject da0
Error received from stop unit command

今回は、zpool offlineでzpoolから切り離した後、camcontrol stopでディスクの回転を止めて、引っこ抜くことにする。

# zpool offline lib_01 da0
# zpool status lib_01
  pool: lib_01
 state: DEGRADED
status: One or more devices has been taken offline by the administrator.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Online the device using 'zpool online' or replace the device with
'zpool replace'.
 scrub: resilver completed after 13h42m with 0 errors on Fri Apr 27 10:13:08 2012
config:

NAME        STATE     READ WRITE CKSUM
lib_01      DEGRADED     0     0     0
  raidz1    DEGRADED     0     0     0
    ad10    ONLINE       0     0     0  900G resilvered
    ad8     ONLINE       0     0     0
    ad6     ONLINE       0     0     0
    da0     OFFLINE      0     0     0
    ad12    ONLINE       0     0     0

errors: No known data errors
# camcontrol stop da0
Unit stopped successfully

物理作業。

単純に引っこ抜く。

一応引っこ抜かれる。

# camcontrol devilst
<ATA ST2000DL003-9VT1 CC3C>        at scbus0 target 1 lun 0 (da1,pass1)
<ATA Hitachi HDS5C302 A580>        at scbus0 target 2 lun 0 (da2,pass2)
<ATA Hitachi HDS72202 A28A>        at scbus0 target 3 lun 0 (da3,pass3)

同じ位置にHDDを挿し直して、スキャン。

# camcontrol rescan all
Re-scan of bus 0 was successful
Re-scan of bus 1 was successful
# camcontrol devlist
<ATA ST2000DL003-9VT1 CC3C>        at scbus0 target 1 lun 0 (da1,pass1)
<ATA Hitachi HDS5C302 A580>        at scbus0 target 2 lun 0 (da2,pass2)
<ATA Hitachi HDS72202 A28A>        at scbus0 target 3 lun 0 (da3,pass3)
<ATA Hitachi HDS5C302 A800>        at scbus0 target 4 lun 0 (pass0,da0)

挿し直して認識されることを確認。

後はいつも通り。

# zpool list status lib_01
  pool: lib_01
 state: DEGRADED
status: One or more devices has been taken offline by the administrator.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Online the device using 'zpool online' or replace the device with
'zpool replace'.
 scrub: resilver completed after 13h42m with 0 errors on Fri Apr 27 10:13:08 2012
config:

NAME        STATE     READ WRITE CKSUM
lib_01      DEGRADED     0     0     0
  raidz1    DEGRADED     0     0     0
    ad10    ONLINE       0     0     0  900G resilvered
    ad8     ONLINE       0     0     0
    ad6     ONLINE       0     0     0
    da0     OFFLINE      0     0     0
    ad12    ONLINE       0     0     0

errors: No known data errors
# zpool replace lib_01 da0
# zpool status lib_01
  pool: lib_01
 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.
 scrub: resilver in progress for 0h0m, 0.00% done, 664h8m to go
config:

NAME           STATE     READ WRITE CKSUM
lib_01         DEGRADED     0     0     0
  raidz1       DEGRADED     0     0     0
    ad10       ONLINE       0     0     0
    ad8        ONLINE       0     0     0
    ad6        ONLINE       0     0     0
    replacing  DEGRADED     0     0     0
      da0/old  OFFLINE      0     0     0
      da0      ONLINE       0     0     0  5.35M resilvered
    ad12       ONLINE       0     0     0

errors: No known data errors

終了を待って、おしまい。