Eine defekte Festplatte wurde ausgetauscht und du möchtest die Neue wieder dem ZFS Raid hinzufügen? Kein Problem, ich beschreibe hier in kurzen Schritten wie du vorgehen kannst.
Punkt 1: Raid Status prüfen
Zuerst prüfen wir den Status und stellen fest das /dev/ada1p3 fehlt (getauscht wurde).
root@localhost:~ # 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: none requested
config:
NAME STATE READ WRITE CKSUM
tank DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
14161449623808796130 UNAVAIL 0 0 0 was /dev/ada1p3
ada0p3 ONLINE 0 0 0
errors: No known data errors
Punkt 2: Partitionstabelle kopieren
Wir schauen uns die Partitionstabelle vom ersten Device /dev/ada0 an.
root@localhost:~ # gpart show ada0
=> 34 976773101 ada0 GPT (466G)
34 128 1 freebsd-boot (64K)
162 8388608 2 freebsd-swap (4.0G)
8388770 968384365 3 freebsd-zfs (462G)
Kopieren diese auf die neue Festplatte /dev/ada1 und prüfen dies nach.
root@localhost:~ # gpart backup ada0 | gpart restore ada1
root@localhost:~ # gpart show ada1
=> 34 976773101 ada1 GPT (466G)
34 128 1 freebsd-boot (64K)
162 8388608 2 freebsd-swap (4.0G)
8388770 968384365 3 freebsd-zfs (462G)
Punkt 3: Neue Festplatte dem ZFS Raid hinzufügen
Wir tauschen die alte Partition mit der Bezeichnung 14161449623808796130 gegen die Neue /dev/ada1p3 aus.
Syntax: zpool replace <pool> <altes_devices> <neues_device>
root@localhost:~ # zpool replace tank 14161449623808796130 /dev/ada1p3
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 '/dev/ada1p3'.
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
Der Bootloader kann bei Bedarf geschrieben werden. (wichtig beim Austausch von /dev/ada0)
root@localhost:~ # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1
bootcode written to ada1
Punkt 4: Resilvering beobachten
Wie folgt beobachtet ihr den Fortschritt.
root@localhost:~ # zpool status
pool: tank
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 912M in 0h0m with 0 errors on Wed Jul 30 08:12:47 2014
config:
NAME STATE READ WRITE CKSUM
tank 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