This guide assumes you want to manually creating the pool, to change default settings, or to not use the entire disk. If you just want to setup ZFS on the entire disk, use the 'ZFS' option in the bsdinstall partitioning menu.
Add some partitions for FreeBSD to use: a freebsd-swap partition and a freebsd-zfs partition.
-a <number>: controls alignment.-s <size>: sets the size of the partition; if not set, it will default to the remaining space on the disk.-l <name>: sets the label for the partition.
Create the swap and zfs partitions
gpart add -a 4K -s 4G -t freebsd-swap -l swap0 nvd0
gpart add -a 4K -t freebsd-zfs -l zfs0 nvd0Standard practice these days, 4k align everything even if it's not a 4k-native disk.
Create a mountpoint and the initial zpool.
kldload zfs
sysctl vfs.zfs.min_auto_ashift=12Mount a tmpfs to /mnt
mount -t tmpfs tmpfs /mntCreate the ZFS Pool
zpool create -f -o altroot=/mnt -O compress=lz4 -O atime=off -m none zroot /dev/gpt/zfs0Create a Boot Environment hierarchy
zfs create -o mountpoint=none zroot/ROOT
zfs create -o mountpoint=none zroot/ROOT/default
mount -t zfs zroot/ROOT/default /mntCreate the rest of the filesystems.
# zfs set mountpoint=/zroot zroot
zfs create -o mountpoint=/tmp -o exec=on -o setuid=off zroot/tmp
zfs create -o mountpoint=/usr -o canmount=off zroot/usr
zfs create zroot/usr/home
zfs create -o setuid=off zroot/usr/ports
zfs create -o exec=off -o setuid=off zroot/usr/src
zfs create -o mountpoint=/var -o canmount=off zroot/var
zfs create -o exec=off -o setuid=off zroot/var/audit
zfs create -o exec=off -o setuid=off zroot/var/crash
zfs create -o exec=off -o setuid=off zroot/var/log
zfs create -o atime=on -o exec=off -o setuid=off zroot/var/mail
zfs create -o exec=on -o setuid=off zroot/var/tmpLinks and Permission
cd /mnt
ln -s usr/home home
chmod 1777 /mnt/tmp
chmod 1777 /mnt/var/tmpzpool set bootfs=zroot/ROOT/default zrootprintf "# Device\tMountpoint\tFStype\tOptions\tDump\tPass #\n/dev/gpt/swap0\tnone\t\tswap\tsw\t0\t0\n" > /tmp/bsdinstall_etc/fstabExit Shell Partitioning mode, bsdinstall will continue and complete the installation.
exitn the post installation step, when asked if you would like to drop into the installed system, choose yes and run the following commands.
sysrc zfs_enable="YES"
sysrc powerd_enable="YES"
# echo 'zfs_load="YES"' >> /boot/loader.confcd /tmp
fetch http://downloads.sourceforge.net/project/refind/0.10.3/refind-bin-0.10.3.zip
unzip refind-bin-0.10.3.zip
rm refind-bin-0.10.3.zip
mkdir /tmp/efi
mount_msdosfs /dev/gpt/EFI%20system%20partition /tmp/efi/
cd /tmp/efi/EFI/Boot
mv bootx64.efi bootx64-windows-10.efi
cp /boot/boot1.efi bootx64-freebsd.efi
cp -a /tmp/refind-bin-0.10.3/refind/icons .
cp -a /tmp/refind-bin-0.10.3/refind/refind_x64.efi bootx64.efi
cp /tmp/refind-bin-0.10.3/refind/refind.conf-sample refind.confConfigure refind and add menu entries
# FreeBSD
menuentry "FreeBSD" {
loader /EFI/Boot/bootx64-freebsd.efi
icon /efi/refind/icons/os_freebsd.png
}
Configure GRUB
menuentry "FreeBSD" {
insmod part_gpt
insmod fat
set root=(hd0,gpt1)
chainloader /efi/freebsd/loader.efi
}