- Исходные данные
# uname -rs FreeBSD 10.4-RELEASE-p9
# zpool status pool: tank1 state: ONLINE status: Some supported features are not enabled on the pool. The pool can still be used, but some features are unavailable. action: Enable all features using 'zpool upgrade'. Once this is done, the pool may no longer be accessible by software that does not support the features. See zpool-features(7) for details. scan: none requested config: NAME STATE READ WRITE CKSUM tank1 ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 ada0p3 ONLINE 0 0 0 ada1p3 ONLINE 0 0 0 errors: No known data errors
Два раздела от разных дисков в зеркале.
Но диски не вечны, и ada0 приказал долго жить. После физической замены диска на новый, видим следующее:# zpool status -xv pool: tank1 state: DEGRADED status: One or more devices could not be opened. Sufficient replicas exist for the pool to continue functioning in a degraded state. action: Attach the missing device and online it using 'zpool online'. see: http://illumos.org/msg/ZFS-8000-2Q scan: none requested config: NAME STATE READ WRITE CKSUM tank1 DEGRADED 0 0 0 mirror-0 DEGRADED 0 0 0 3199557894021506640 UNAVAIL 0 0 0 was /dev/ada0p3 ada1p3 ONLINE 0 0 0 errors: No known data errors
- Готовим новый диск
Смотрим, что есть на новом диске:# gpart show ada0 gpart: No such geom: ada0.
Пусто. Если на диск есть разделы, то выполняем команду:# gpart destroy -F ada0
Далее, на ad0 необходимо сделать такие же разделы, как и на ada1.
Смотрим, что есть на ada1:# gpart show ada1 => 34 468862061 ada1 GPT (224G) 34 6 - free - (3.0K) 40 128 1 freebsd-boot (64K) 168 33554432 2 freebsd-swap (16G) 33554600 435307488 3 freebsd-zfs (208G) 468862088 7 - free - (3.5K)
И делаем так же на ada0:# gpart create -s gpt ada0 # gpart add -b 40 -s 128 -t freebsd-boot ada0 # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0 # gpart add -s 33554432 -t freebsd-swap ada0 # gpart add -s 435307488 -t freebsd-zfs ada0
Итого:# gpart show ada0 => 34 468862061 ada0 GPT (224G) 34 6 - free - (3.0K) 40 128 1 freebsd-boot (64K) 168 33554432 2 freebsd-swap (16G) 33554600 435307488 3 freebsd-zfs (208G) 468862088 7 - free - (3.5K)
- Меняем раздел в zfs пуле
# zpool replace tank1 /dev/ada0p3
Смотрим статус:# zpool status -xv pool: tank1 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 Tue Jul 17 15:06:40 2018 2.78G scanned out of 50.0G at 114M/s, 0h7m to go 2.77G resilvered, 5.55% done config: NAME STATE READ WRITE CKSUM tank1 DEGRADED 0 0 0 mirror-0 DEGRADED 0 0 0 replacing-0 UNAVAIL 0 0 0 3199557894021506640 UNAVAIL 0 0 0 was /dev/ada0p3/old ada0p3 ONLINE 0 0 0 (resilvering) ada1p3 ONLINE 0 0 0 errors: No known data errors
Ждем окончания восстановления пула:# zpool status -xv all pools are healthy
# zpool status tank1 pool: tank1 state: ONLINE status: Some supported features are not enabled on the pool. The pool can still be used, but some features are unavailable. action: Enable all features using 'zpool upgrade'. Once this is done, the pool may no longer be accessible by software that does not support the features. See zpool-features(7) for details. scan: resilvered 50.0G in 0h5m with 0 errors on Tue Jul 17 15:12:20 2018 config: NAME STATE READ WRITE CKSUM tank1 ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 ada0p3 ONLINE 0 0 0 ada1p3 ONLINE 0 0 0 errors: No known data errors
Mission complete.
Статья опубликована: 2018-07-17 14:29:12
Последние правки: 2018-09-15 21:54:05
Меняем вышедший из строя диск в пуле zfs FreeBSD.