ZFS ZFS mirror and bootcode

I reinstalled FreeBSD-12-RELEASE and this time I choose to use both my SSD’s as an ZFS mirror-0. Reinstalling is part of my learning curve ;). I remember reading somewhere that mirroring itself is not enough if one drive fails. The other drive should be fine, but can it also BOOT if the first drive fails? Or do I have to copy the boot code to that second drive after installing FreeBSD?
 
The installer should already have done this. Or did you do a manual install?
No. No manual install. I used the guided option in the installer. So I should be good to go? Is there a way to test it, other than removing one drive and try to boot the system?
 
I used the guided option in the installer. So I should be good to go?
Yes, you should be good. You could verify it by looking at the partition tables of both disks. They should be the same.

Is there a way to test it, other than removing one drive and try to boot the system?
I've done this, just to double check and verify. It's easy enough to do, so why not try it?
 
Yes, you should be good. You could verify it by looking at the partition tables of both disks. They should be the same.


I've done this, just to double check and verify. It's easy enough to do, so why not try it?
I checked the partition tables and they are the same. All bootcode files seem to be there. I was just confused if the bootloader is also on the second disk. I read somewhere on the net that the mirrored drive needs to get the bootloader too, but that was for Solaris. It might be different in FreeBSD.
 
On FreeBSD only the ZFS partition is mirrored, not the whole disk. If you have a hardware RAID card for example both disks are handled by the RAID firmware and the machine only "sees" one (virtual) disk.
 
Here's a small script that can be used to verify that the correct bootcode is installed on all mirrors... It tries to autodetect EFI/legacy boot mode and checks the right files...

# ./check-bootcode -v
/dev/da4p1: OK (type=efi, checksum=13854)
/dev/da4p2: OK (type=freebsd-boot, checksum=2230)
/dev/da5p1: OK (type=efi, checksum=13854)
/dev/da5p2: OK (type=freebsd-boot, checksum=2230)

# ./check-bootcode -h
Usage: ./check-bootcode [-v|--verbose] [-r|--repair] [-h|--help]
 

Attachments

Back
Top