- You will be using the FreeBSD installer's automatic ZFS partitioning scheme
- Your boot filesystem is
zfs:zroot/ROOT/default
(the default with the installer) - Your SD card is device
da0
- Install FreeBSD using the automatic installer, choosing ZFS auto partitioning
- Drop into a shell after finishing the installer
- Create a GPT partition table on
da0
:
gpart create -s GPT da0
- Create a
freebsd-boot
partition:
gpart add -b 40 -s 472 -t freebsd-boot da0
- Install the loader and a protective MBR on this drive:
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
- Create a ZFS partition on the device
gpart add -t freebsd-zfs da0
- Create a ZFS pool using this partition (
da0p2
) and mount it somewhere like/mnt/sd
:
zpool create -o altroot=/mnt/sd zboot /dev/da0p2
- put the following in
/mnt/sd/boot.config
(or wherever you mounted the ZFS partition from the SD card):
zfs:zroot/ROOT/default:
- You're done!
The gptzfsboot
loader will first look for ZFS partitions on the same disk it is run from, which in this case will be the SD card.
If no ZFS partition is found, it will look through other disks in BIOS boot order.
If you have zfs partitions on any other disk in the microserver, then FreeBSD will attempt to boot from these instead, breaking the boot process as it attempts to find the kernel in that filesystem.
By placing /boot.config
in a ZFS partition on the same device we're booting from (the SD card), we're instructing gptzfsboot
to read options from it, in this case telling it to boot from the zroot/ROOT/default
ZFS filesystem.
See https://www.freebsd.org/cgi/man.cgi?query=gptzfsboot for more information about why this works: