Инструменты пользователя

Инструменты сайта


wiki:technical:ds:zfs_raid1

Замена диска в RAID1 под FreeBSD

Смотрим состояние массива:

# zpool status
  pool: tank
 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: resilvered 10.5G in 0h9m with 0 errors on Mon Feb  1 09:49:38 2016
config:

	NAME                     STATE     READ WRITE CKSUM
	tank                     DEGRADED     0     0     0
	  mirror-0               DEGRADED     0     0     0
	    ada1p3               ONLINE       0     0     0
	    9066085129501579450  UNAVAIL      0     0     0  was /dev/ada0p3

errors: No known data errors

Копируем разметку с рабочего диска:

# gpart backup ada1 | gpart restore -F /dev/ada0

Монтируем:

# zpool import -o altroot=/mnt tank

Добавляем:

# zpool replace tank 9066085129501579450 ada0p3
Make sure to wait until resilver is done before rebooting.

If you boot from pool 'tank', 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 -i 1 da0

Ставим загрузчик:

# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
bootcode written to ada0

Проверяем:

# zpool status
  pool: tank
 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 May 10 22:34:44 2016
        1.08G scanned out of 196G at 8.42M/s, 6h35m to go
        1.07G resilvered, 0.55% done
config:

	NAME                       STATE     READ WRITE CKSUM
	tank                       DEGRADED     0     0     0
	  mirror-0                 DEGRADED     0     0     0
	    ada1p3                 ONLINE       0     0     0
	    replacing-1            UNAVAIL      0     0     0
	      9066085129501579450  UNAVAIL      0     0     0  was /dev/ada0p3/old
	      ada0p3               ONLINE       0     0     0  block size: 512B configured, 4096B native  (resilvering)

errors: No known data errors
wiki/technical/ds/zfs_raid1.txt · Последние изменения: 2017/04/07 19:51 (внешнее изменение)