NomadBSD ZFS installation file system hierarchy

The ZFS file system hierarchy seems a bit strange to me and I am asking why it is not done in the usual FreeBSD way as explained in .
In NomadBSD all the file system is put in the boot environment but, for example, the /var/log directory may not be preserved, if I switch to a new boot environment; the /var/log directory can be put outside the BE.


I have found a problem with this ZFS file system structure: the command beactl export sourceBe exports only a part of the boot environment, is not possible to backup the BE.
I am proposing a patch to the /usr/libexec/nomadbsd-install script, the new mkzfs function is:

mkzfs() {
	zpool create -o altroot=/mnt -m none -f ${POOL} $1 || \
		bail "Couldn't create pool ${POOL}"
	zfs set compress=on ${POOL}
	zfs set atime=off ${POOL}
	zfs_create -o mountpoint=none ${POOL}/ROOT
	zfs_create -o mountpoint=/ ${NOMADBSDROOT}
	zfs_create -o canmount=off -o mountpoint=/usr ${POOL}/usr
	zfs_create  ${POOL}/usr/home
	zfs_create -o exec=off -o setuid=off ${POOL}/usr/src
	zfs_create ${POOL}/usr/obj
	zfs_create -o mountpoint=/usr/ports -o setuid=off \
	zfs_create -o exec=off -o setuid=off -o compression=off \
	zfs_create -o exec=off -o setuid=off -o compression=off \
	zfs_create -o canmount=off -o mountpoint=/var ${POOL}/var
	zfs_create -o exec=off -o setuid=off ${POOL}/var/audit
	zfs_create -o exec=off -o setuid=off ${POOL}/var/crash
	zfs_create -o exec=off -o setuid=off ${POOL}/var/log
	zfs_create -o atime=on -o exec=off -o setuid=off \
	zfs_create -o exec=on -o setuid=off   ${POOL}/var/tmp
	ln -s usr/home /mnt/home
	ln -s usr/src/sys /mnt/sys
	chmod 1777 /mnt/var/tmp
	zpool set bootfs=${NOMADBSDROOT} ${POOL}

I have tested the patch in Virtual Box.

1 Like

Thank you for this!

Could you please create an issue for this on Github?

That way it doesn’t get lost. :slight_smile:

1 Like

Done, just created.

Thanks a lot, Maurizio!