Cloning Boot Partitions / Add Third Disk to ZFS Mirror on pfSense

Assuming you have a pool, pfSense, in a mirror of disks ada0p3 and ada1p3. We want to add ada2 as a third disk to the mirror array. By default, pfSense ZFS mirror installation will use p1 (partition 1) for boot and p2 for swap.

gmirror status, zpool list, and zpool status [pool] can be used to help determine names to use below.

First we will clone one of the existing drives partition tables to the new disk:

  • gpart backup ada0 | gpart restore -F ada2

Then we will use dd to mirror the boot partition:

  • dd if=/dev/ada0p1 of=/dev/ada2p1 bs=1M

We will use gmirror to clone the swap partition:

  • gmirror insert swap ada2p1

And for the pool you can either add a spare or an active third disk.

  • Hot Spare: zpool add pfSense spare ada2p3
  • Active Disk: zpool attach pfSense ada2p3

Removal Process (10-21-2023):

  • gmirror remove swap ada2p2
  • zpool detach pfSense ada2p3