Skip to content

Instantly share code, notes, and snippets.

@kbruner
Created November 3, 2020 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbruner/312dfdabfd57c171a62c1add88a511b6 to your computer and use it in GitHub Desktop.
Save kbruner/312dfdabfd57c171a62c1add88a511b6 to your computer and use it in GitHub Desktop.
FreeBSD post-install steps for ZFS-on-root and UEFI
cat >> /boot/loader.conf <<END
zfs_load="YES"
zpool_cache_load="YES"
zpool_cache_name="/boot/zfs/zpool.cache"
zpool_cache_type="/boot/zfs/zpool.cache"
vfs.root.mountfrom="zfs:zroot/ROOT/default"
END
cat >> /etc/rc.conf <<END
zfs_enable="YES"
zfsd_enable="YES"
END
cat >> /etc/fstab <<END
/dev/gpt/efi /boot/efi msdosfs rw,late 0 0
/dev/nvd0p6 none swap sw 0 0
END
# For the /dev/null issue mentioned above
rm /dev/null
mount -t devfs devfs /dev
# UEFI
mkdir /boot/efi
mount -t msdosfs /dev/gpt/efi /boot/efi
mkdir -p /boot/efi/efi/boot
cp /boot/loader.efi /boot/efi/efi/boot/bootx64.efi
# efirt was already compiled into 13.0-CURRENT installer kernel
# but do this anyway
kldload efirt
mkdir -p /boot/efi/efi/freebsd
cp /boot/loader.efi /boot/efi/efi/freebsd/
# Make sure you use your efi partition's device below
efibootmgr -c -L freebsd -l nvd0p5:/efi/freebsd/loader.efi
# Assuming your freebsd EFI partition is numbered 0001:
efibootmgr -a -b 1
# Add any other boot partitions with -a, then add to the
# -o option 1 to set the boot order
efibootmgr -o 1,0
# Legacy boot partition. Check the partition index (-1)
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 nvd0
exit
# And good luck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment