Replacing a disk in a zfs boot pool
This is just a documentation of what i did today. Nothing exiting.
A disc in my boot pool showed errors and the disk should be replaced
zpool status
pool: croot
state: ONLINE
NAME STATE READ WRITE CKSUM
croot ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ada0p4 ONLINE 0 0 0
ada1p4 ONLINE 10 0 0
Lets see the disk name to pull the right one and remove the disc from the pool
camcontrol devlist
<INTENSO SSD V0718B0> at scbus2 target 0 lun 0 (pass1,ada1)
<ST12000VN0008-2YS101 SC60> at scbus3 target 0 lun 0 (pass2,ada2)
zpool offline croot ada1p4
Replace the drive, see if you can see it and copy the partition layout
camcontrol devlist
/sbin/gpart backup ada0 | /sbin/gpart restore -F ada1
gpart show ada1
Then replace the disc in the pool and wait until resilvering is done
zpool replace croot ada1p4
# zpool status
pool: croot
state: DEGRADED
config:
NAME STATE READ WRITE CKSUM
croot DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
ada0p4 ONLINE 0 0 0
replacing-1 DEGRADED 0 0 0
ada1p4/old OFFLINE 0 0 0
ada1p4 ONLINE 0 0 0 (resilvering)
# zpool status
pool: croot
state: ONLINE
scan: resilvered 16.7G in 00:01:03 with 0 errors on Sat Mar 14 17:16:41 2026
config:
NAME STATE READ WRITE CKSUM
croot ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ada0p4 ONLINE 0 0 0
ada1p4 ONLINE 0 0 0
errors: No known data errors
We need to make sure we can boot from the disk
mkdir /mnt/efi1
newfs_msdos /dev/ada1p1
mount -t msdosfs /dev/ada1p1 /mnt/efi1
mkdir -p /mnt/efi1/EFI/BOOT
mount -t msdosfs /dev/ada0p1 /mnt/efi0
cp /mnt/efi0/EFI/BOOT/BOOTX64.EFI /mnt/efi1/EFI/BOOT/BOOTX64.EFI
And just to be sure remove the disc and see if reboot is working
NAME STATE READ WRITE CKSUM
croot DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
ada0p4 FAULTED 0 0 0 corrupted data
ada0p4 ONLINE 0 0 0
Attach the first drive and reboot