Can't write boot code to ZFS replacement drive

  • I just replaced a drive from a ZFS mirror following the advice in the ZFS sticky, the command line's and some blog I found; I was able to replace the drive successfully, actually it was easier than I though it was gonna be, but in the last step I'm asked to write the boot code but it won't let me.

    I did zpool status and the array is full online. I had like 5min downtime. 😁

  • Try running the following sysctl, and then re-run the gpart command:

    sysctl kern.geom.debugflags=0x10

  • [2.4.2-RELEASE][root@ FQDN]/root: sysctl kern.geom.debugflags=0x10
    kern.geom.debugflags: 0 -> 16

    [2.4.2-RELEASE][root@FQDN]/root: gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
    gpart: /dev/ada0p1: Operation not permitted

    Then I went rogue and tried my own:

    [2.4.2-RELEASE][root@FQDN]/root: gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0p1
    gpart: No such geom: ada0p1.

    As you may see, I have no clue how disk geometry works. 😂 I'm very happy I didn't for more than a few minutes offline though, now I have time to schedule a reinstall. Whoever came up with backup & restores on pfSense is a f*cking genius! They way packages reinstall themselves and everything is back as before it just amazing. Thanks for your help!

Log in to reply