Mirroring zroot on FreeBSD 14

Followed the directions from: https://blog.frankleonhardt.com/2025/add-mirror-to-single-zfs-disk/ but I don’t want to lose the notes, so I’m copying what I did here.

Move all data off the 4TB ssd (ada1)

Run the gpart function to move bootcode over:

gpart destroy -F ada1 ;
gpart backup ada0 | gpart restore ada1 ;
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1 ;

Took the “ssd” zpool offline, and then attached as a mirror:

zpool destroy ssd;
zpool attach zroot ada0p4 ada1p4;

Because the partition of the 1TB is not as large as the new 4TB drive, I waited until the resilvering completed, and then updated the end partition from 800GB -> 3.5TB.

gpart show ada1;

# Resize without a "size" flag takes all remaining space
gpart resize -i 4 ada1 ;

gpart show ada1;

Now I need to sort out how to break the mirror and use only the 4TB disk.

I can’t facepalm hard enough

Turns out efiboot is a royal pain and for some reason kept referencing a device that didn’t exist in /etc/fstab when I booted using the new drive.

To make edits to the root filesystem, I had to turn that on for ZFS:

zfs readonly=off zroot/ROOT/default

# Since we're here, let's make it autoexpand the pool
zpool set autoexpand=on zroot

For fstab, I had to change the values from:

# Device        Mountpoint  FStype  Options     Dump    Pass#
/dev/gpt/efiboot0    /boot/efi  msdosfs rw      2   2

into:

# Device        Mountpoint  FStype  Options     Dump    Pass#
/dev/ada0p1     /boot/efi   msdosfs rw      2   2

Once that was over, I was able to boot into a normal environment with all my usual stuff.

That lead to me seeing the (original sized) 800GB zfs root partition:

$ zpool list
NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
archive  4.55T  2.44T  2.10T        -         -     0%    53%  1.00x    ONLINE  -
zroot    800G   29.8G  737G         -     ~2.7T     5%     9%  1.00x    ONLINE  -

What?! I thought this was supposd to automatically grow the space!

zpool online -e zroot ada0p4 and then we have:

NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
archive  4.55T  2.44T  2.10T        -         -     0%    53%  1.00x    ONLINE  -
zroot    3.51T  80.8G  3.43T        -         -     1%     2%  1.00x    ONLINE  -