Check zpool status, see which disk has failed:
# zpool status
pool: zroot
state: DEGRADED
status: One or more devices has been removed 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'.
scan: none requested
config:
NAME STATE READ WRITE CKSUM
zroot DEGRADED 0 0 0
raidz2-0 DEGRADED 0 0 0
da0p4 ONLINE 0 0 0
da1p4 ONLINE 0 0 0
da2p4 ONLINE 0 0 0
da3p4 ONLINE 0 0 0
12385660660938982245 REMOVED 0 0 0 was /dev/da4p4
da5p4 ONLINE 0 0 0
errors: No known data errors
After physically replacing the disk, verify dmesg
output:
# dmesg | grep ^da4
da4 at ciss0 bus 0 scbus0 target 4 lun 0
da4: <HP RAID 0 OK> s/n PDNLH0BRHA0725 detached
da4 at ciss0 bus 0 scbus0 target 4 lun 0
da4: <HP RAID 0 OK> Fixed Direct Access SPC-3 SCSI device
da4: Serial Number PDNLH0BRHA0725
da4: 135.168MB/s transfers
da4: Command Queueing enabled
da4: 953837MB (1953459632 512 byte sectors)
da4 at ciss0 bus 0 scbus0 target 4 lun 0
da4: <HP RAID 0 OK> s/n PDNLH0BRHA0725 detached
da4 at ciss0 bus 0 scbus0 target 4 lun 0
da4: <HP RAID 0 OK> Fixed Direct Access SPC-3 SCSI device
da4: Serial Number PDNLH0BRHA0725
da4: 135.168MB/s transfers
da4: Command Queueing enabled
da4: 953837MB (1953459632 512 byte sectors)
Take the disk offline from zpool:
# zpool offline zroot 12385660660938982245
It should now show the disk is offline:
# zpool status
pool: zroot
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'.
scan: none requested
config:
NAME STATE READ WRITE CKSUM
zroot DEGRADED 0 0 0
raidz2-0 DEGRADED 0 0 0
da0p4 ONLINE 0 0 0
da1p4 ONLINE 0 0 0
da2p4 ONLINE 0 0 0
da3p4 ONLINE 0 0 0
12385660660938982245 OFFLINE 0 0 0 was /dev/da4p4
da5p4 ONLINE 0 0 0
errors: No known data errors
Check partition scheme on an existing disk:
# gpart backup da3
GPT 152
1 efi 40 409600 efiboot3
2 freebsd-boot 409640 1024 gptboot3
3 freebsd-swap 411648 4194304 swap3
4 freebsd-zfs 4605952 1948852224 zfs3
Configure partition on new disk by copying it from an existing disk. Following command will copy partition table from an existing disk (da3) to new disk (da4):
# gpart backup da3 | gpart restore -F da4
And verify partition table on the new disk:
# gpart show da4
=> 40 1953459552 da4 GPT (931G)
40 409600 1 efi (200M)
409640 1024 2 freebsd-boot (512K)
410664 984 - free - (492K)
411648 4194304 3 freebsd-swap (2.0G)
4605952 1948852224 4 freebsd-zfs (929G)
1953458176 1416 - free - (708K)
Now replace the disk in zpool:
# zpool replace zroot 12385660660938982245 /dev/da4p4
Make sure to wait until resilver is done before rebooting.
If you boot from pool 'zroot', you may need to update
boot code on newly attached disk '/dev/da4p4'.
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
If this is your boot volume, make sure the new disk also has boot code:
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da4
partcode written to da4p1
bootcode written to da4
Your zpool should be now resilvering the new disk. It may take a few hours:
# zpool status
pool: zroot
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 Wed May 20 23:05:00 2020
920M scanned out of 1.84T at 13.5M/s, 39h32m to go
153M resilvered, 0.05% done
config:
NAME STATE READ WRITE CKSUM
zroot DEGRADED 0 0 0
raidz2-0 DEGRADED 0 0 0
da0p4 ONLINE 0 0 0
da1p4 ONLINE 0 0 0
da2p4 ONLINE 0 0 0
da3p4 ONLINE 0 0 0
replacing-4 OFFLINE 0 0 0
12385660660938982245 OFFLINE 0 0 0 was /dev/da4p4/old
da4p4 ONLINE 0 0 0
da5p4 ONLINE 0 0 0
errors: No known data errors
Wait for it to finish. You don’t need to manually take the disk online.
It should be back to normal after a while:
# zpool status zroot
pool: zroot
state: ONLINE
scan: resilvered 295G in 6h59m with 0 errors on Thu May 21 06:04:08 2020
config:
NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
raidz2-0 ONLINE 0 0 0
da0p4 ONLINE 0 0 0
da1p4 ONLINE 0 0 0
da2p4 ONLINE 0 0 0
da3p4 ONLINE 0 0 0
da4p4 ONLINE 0 0 0
da5p4 ONLINE 0 0 0
errors: No known data errors