Skip to content

Instantly share code, notes, and snippets.

Created November 3, 2020 06:09
What would you like to do?
manual ZFS-on-root disk partitioning
# Remember to replace nvd0 with your disk's device name
# Legacy boot partition
gpart add -t freebsd-boot -s 256k -l boot nvd0
gpart add -t efi -s 2m -l efi nvd0
newfs_msdos /dev/gpt/efi
# Swap. Adjust size (-s) as desired.
gpart add -t freebsd-swap -l swap -a 1m -s 8G nvd0
# ZFS. Adjust size as needed or omit -s flag and arg to use remaining disk
gpart add -t freebsd-zfs -l zroot -a 1m -s 200G nvd0
# ZFS pool
zpool create -R /mnt -o cachefile=/tmp/zpool.cache -O mountpoint=/ \
-O atime=off -O canmount=off -O compression=on \
zroot nvd0
zfs create -o canmount=off -o mountpoint=none zroot/ROOT
zfs create -o mountpoint=/ zroot/ROOT/default
zpool set bootfs=zroot/ROOT/default zroot
zfs create zroot/home
zfs create -o canmount=off zroot/usr
zfs create zroot/usr/local
zfs create zroot/usr/obj
zfs create zroot/usr/src
zfs create zroot/usr/ports
zfs create zroot/usr/ports/distfiles
zfs create -o canmount=off zroot/var
zfs create zroot/var/jail
zfs create zroot/var/log
zfs create zroot/var/tmp
zfs create zroot/tmp
# Copy the zpool cache file to /boot
mkdir -p /mnt/boot/zfs
cp /tmp/zpool.cache /mnt/boot/zfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment