How to set zfs mount parameters?

I manually installed FreeBSD on ZFS, but I only set up mounting zroot/ROOT/default to /. I noticed the default Auto(ZFS) installer mounts several other locations. What parameters (like recordsize, compress, etc) do I need to set for mounting these places?
1000042378.jpg
1000042379.jpg
 
Each zfs command is logged in the history of a zpool. That history is a rich treasure source for forensics as it cannot be altered. You get it by zpool history.

Now have a look on the very beginning of that history done by the bsdinstaller if choosen to use it for RELEASE-15.0:
Code:
# zpool history
History for 'poolname':
2026-01-28.13:52:06 zpool create -o altroot=/mnt -O compression=on -O atime=off -m none -f poolname ada0p3
2026-01-28.13:52:06 zfs create -o mountpoint=none poolname/ROOT
2026-01-28.13:52:06 zfs create -o mountpoint=/ poolname/ROOT/default
2026-01-28.13:52:06 zfs create -o mountpoint=/home poolname/home
2026-01-28.13:52:06 zfs create -o mountpoint=/tmp -o exec=on -o setuid=off poolname/tmp
2026-01-28.13:52:06 zfs create -o mountpoint=/usr -o canmount=off poolname/usr
2026-01-28.13:52:06 zfs create -o setuid=off poolname/usr/ports
2026-01-28.13:52:07 zfs create poolname/usr/src
2026-01-28.13:52:07 zfs create -o mountpoint=/var -o canmount=off poolname/var
2026-01-28.13:52:07 zfs create -o exec=off -o setuid=off poolname/var/audit
2026-01-28.13:52:07 zfs create -o exec=off -o setuid=off poolname/var/crash
2026-01-28.13:52:07 zfs create -o exec=off -o setuid=off poolname/var/log
2026-01-28.13:52:07 zfs create -o atime=on poolname/var/mail
2026-01-28.13:52:07 zfs create -o setuid=off poolname/var/tmp
2026-01-28.13:52:07 zfs set mountpoint=/poolname poolname
2026-01-28.13:52:07 zpool set bootfs=poolname/ROOT/default poolname
2026-01-28.13:52:07 zpool set cachefile=/mnt/boot/zfs/zpool.cache poolname
2026-01-28.13:52:07 zfs set canmount=noauto poolname/ROOT/default
2026-01-28.14:50:06 zfs create poolname/usr/local
The last command 1 hour after the installation I did manually.
 
The reference I use is in release/tools/vmimage.subr:

Code:
        cd ${DESTDIR} && ${MAKEFS} -t zfs ${MAKEFSARGS} \
            -o poolname=zroot -o bootfs=zroot/ROOT/default -o rootpath=/ \
            -o fs=zroot\;mountpoint=none \
            -o fs=zroot/ROOT\;mountpoint=none \
            -o fs=zroot/ROOT/default\;mountpoint=/\;canmount=noauto \
            -o fs=zroot/home\;mountpoint=/home \
            -o fs=zroot/tmp\;mountpoint=/tmp\;exec=on\;setuid=off \
            -o fs=zroot/usr\;mountpoint=/usr\;canmount=off \
            -o fs=zroot/usr/ports\;setuid=off \
            -o fs=zroot/usr/src \
            -o fs=zroot/usr/obj \
            -o fs=zroot/var\;mountpoint=/var\;canmount=off \
            -o fs=zroot/var/audit\;setuid=off\;exec=off \
            -o fs=zroot/var/crash\;setuid=off\;exec=off \
            -o fs=zroot/var/log\;setuid=off\;exec=off \
            -o fs=zroot/var/mail\;atime=on \
            -o fs=zroot/var/tmp\;setuid=off \
            ${VMBASE} ./METALOG

It's also available in (imo) less clear form in usr.sbin/bsdinstall/scripts/zfsboot, which is what bsdinstall(8) calls.
 
your setup, with a single boot/ROOT/default is not valid for boot environments. a manual install has to set up the datasets as specified above. back up important files and reinstall properly.
 
Lots of good info here. One that I've used has been "do a default install into a VM and then look at zpool history". That will give you a record of what datasets are created by default, the default properties, etc. That is your baseline if you do manual stuff. Things like compression are not very interesting, but mountpoints and canmount are. Recordsize becomes interesting if a dataset is being used for DB stuff but for most things the default (I think is 4K) covers most things.
Boot Environments get interesting, again do a default install into a VM and study what has been created.
 
your setup, with a single boot/ROOT/default is not valid for boot environments. a manual install has to set up the datasets as specified above. back up important files and reinstall properly.
But single zroot/ROOT/default can boot normally. What problems could occur if I don't set up those things?
 
the installer sets up that specific arrangement of datasets for the boot-environments feature, mainly. continuing with your arrangement makes your /home part of the boot-environment snapshot, which it doesn't expect. thus, if you ever roll back, you'll destroy everything in your home directory since the snapshot was taken. also, your setup leaves a bunch of directories without their noexec or nosetuid mount settings, which degrades system security away from the baseline.
 
zfs create the datasets then put files into them. It requires a little extra planning.

Yes, one can create the datasets and move the files after the fact, if one is ok with the PITA.

If you want to do this after the fact, zfs create the necessary datasets and rsync -aHW them (-aH preserves hard links, you want this where as cp -R does not). Then rename the directories being replaced and zfs rename the datasets in their stead, one at a time to avoid causing a significant outage. After all the work is done remove the renamed directories.

It's not hard to do, just tedious.
 
Back
Top