zfs mirrorの取り換え
別段dmesgにエラー出すこともなく何となく動き続けてたのだけど、どうも動きがもっさりしてきたので、昨晩zpool scrubしといたら、エラー吐きまくってた。というわけで、予備のHDDと交換。
まったく同じWD30EZRXを買ってたので、さくっと入れ替え。メモ。
取り換え前
# zpool status pool: ztank state: ONLINE status: scrub canceled on Mon Sep 15 20:41:02 2014 config: NAME STATE READ WRITE CKSUM ztank ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 ada1p3 ONLINE 0 0 0 ada0p3 ONLINE 0 0 0 errors: No known data errors
取り外し
# zpool detach ztank ada0p3 # zpool status pool: ztank state: ONLINE status: scrub canceled on Mon Sep 15 20:41:02 2014 config: NAME STATE READ WRITE CKSUM ztank ONLINE 0 0 0 ada1p3 ONLINE 0 0 0 errors: No known data errors # gpart show ada0 => 34 5860533101 ada0 GPT (2.7T) 34 6 - free - (3.0k) 40 128 1 freebsd-boot (64k) 168 2097152 2 freebsd-swap (1.0G) 2097320 5858435808 3 freebsd-zfs (2.7T) 5860533128 7 - free - (3.5k)
シャットダウンして、ada0を新しいHDDに差し替える。
SingleUserModeでリブートして、いつもの作業前のお約束。
# mount -u / # zfs mount -o ro ztank/usr # zfs mount ztank/var # zfs mount ztank/var/empty # zfs mount ztank/tmp # /etc/rc.d/adjkerntz start
HDDが同じなので、元のgpart通りに切ればよし、その後で、mirrorに追加する。
# gpart add -b 40 -s 128 -t freebsd-boot ada0 ada0p1 added # gpart add -b 168 -s 2097152 -t freebsd-swap ada0 ada0p2 added # gpart add -b 2097320 -t freebsd-zfs ada0 ada0p3 added # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -t 1 ada0 # zpool attach ztank ada1p3 ada0p3 Make sure to wait until resilver is done before rebooting. If you boot from pool 'ztank', you may need to update boot code on newly attached disk 'ada0p3'. Assuming you use GPT partitioning and 'da0' is your new boot disk you may use the following command: gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -t 1 da0
しばらくたった後。
# zpool status pool: ztank state: ONLINE 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 Mon Sep 15 12:21:14 2014 403G scanned out of 2.64T at 71/s, (scan is slow, no estimated time) 403G resilvered, 14.93% done config: NAME STATE READ WRITE CKSUM ztank ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 ada1p3 ONLINE 0 0 0 ada0p3 ONLINE 0 0 0 (resilvering) errors: No known data errors