Mount zfs pool on Nanobsd

I'm new to Nanobsd, built with Feebsd 12 (compile Generic kernel all modules), everything run as expected, now I intend to build a zfs pool, but being a filesystem (ro) it is not possible, I think of a link to /var or /etc., but I'm not sure it would be the ideal way out. I also didn't find anything similar in ~ /tools/nanobsd/embedded.

What does it take to build a persistent pool? Is there any variable to be defined in my custom.cfg for this? I can create the ex pool. (zpool create mypool mirror /dev/ada1 /dev/ada2) but it is not possible to mount due to the read-only root filesystem.
 
I have to admit I have very little experience with nanobsd but I believe this is commonly solved by having two partitions. The first partition is read-only and contains the nanabsd install. The second partition is read-write and has a /config directory (or something similar). Things that may need to be configurable are then symlinked from /etc/rc.conf to /config/rc.conf for example. That will leave the main OS filesystem read-only while allowing you to modify certain configuration files.
 
You could include the settings needed by using the overlay structure.
Notice in the /nanobsd directory there is a /files directory.
You can pre-build rc.conf and fstab under this directory.
You will need to create the file structure under this directory (ie. create /etc).
The statement you need in your nanobsd config file is:
customize_cmd cust_install_files

Here is my command which uses NANO_NAME variable for various builds.
With this I can setup various builds each with thier own overlay.

cust_install_build_files ( ) (
cd "${NANO_TOOLS}/${NANO_NAME}/files"
find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)' | cpio -Ldumpv ${NANO_WORLDDIR}

if [ -n "${NANO_CUST_FILES_MTREE}" -a -f ${NANO_CUST_FILES_MTREE} ]; then
CR "mtree -eiU -p /" <${NANO_CUST_FILES_MTREE}
fi
)
 
An easy path for me, what I did, and now running ...

Create Dataset in /var/mypool, where /var is written in memory.

For 'mypool' to be imported at boot, there must be /boot/zpool.cache, and it must be in /cfg to persist. For some reason "mypool" is imported at boot, but is not mounted in /var/ mypool. If you create 'mypool' with <zpool create -m none> then <zfs create -o mountpoint = /var/data mypool/data> everything works as expected and I will have "mypool/data" mounted after boot.

In my research they say that zpool.cache is only necessary for Root ZFS in addition to saving information from the labeled disks etc ... important for recovery. I believe it is possible to import and mount the pool in another way but I have not found how to do it.
 
Back
Top