Solved Replacing failed disk in ZFS (bootable) mirror - how to recover bootsector

Petr Fischer

Active Member

Reaction score: 7
Messages: 106

Hello, I have simple ZFS mirror from 2 disks. Contains zroot. Is bootable (GPT).

1) ZFS mirror was created during FreeBSD installation - I assume, that installer wrote proper gpt bootsector to both disks, so when one disk die in the future, system can boot from second disk - is this true?

2) replacing dead/failed disk in mirror - if first drive fail and I replace it and create correct GPT partitions manually, I can resilver ZFS then, thats OK, but how about boot sector and boot gpt partition - how can I recover it?

Thanks!
 

ShelLuser

Son of Beastie

Reaction score: 1,669
Messages: 3,512

1) ZFS mirror was created during FreeBSD installation - I assume, that installer wrote proper gpt bootsector to both disks, so when one disk die in the future, system can boot from second disk - is this true?
I don't know for sure but I wouldn't rely on it. Also because it's easy enough to bootstrap it again using gpart.

2) replacing dead/failed disk in mirror - if first drive fail and I replace it and create correct GPT partitions manually, I can resilver ZFS then, thats OK, but how about boot sector and boot gpt partition - how can I recover it?
See gpart(8). Something in the likes of # gpart bootcode -p /boot/gptzfsboot -i 1 ada0 where this is obviously an example and you need to swap out the values for those related to your own system.

(edit) After you actually added the proper slices of course, that's also described in the manual page (sort off).
 
OP
OP
Petr Fischer

Petr Fischer

Active Member

Reaction score: 7
Messages: 106

bsdinstall.log is our friend. There is every single command used during installation. It looks like gpart bootcode was called for both disks in mirror. Verified.
 
Top