There are multiple ways and tools to create jails, and now that disk spaces is becoming cheaper the creation of a full jail (having already compiled a world) is just a matter of seconds:
zfs create tank/jails/sandbox
zfs create tank/jails/sandbox/home
zfs create tank/jails/sandbox/tmp
make installworld DESTDIR=/jails/sandbox SRCCONF=/etc/src-jail.conf
For updating existing jails currently I am using something like:
for jail in /jails/*; do
make installworld delete-old delete-old-libs DESTDIR=$jail
done
It works but it implies a "downtime" besides being a destructive procedure since there is no way to rollback if required.
There are some methods describing how to create a base image and then using nullfs
to just mount a read-only skeleton or others using symlinks but among all the possible options I am wondering how you deal with rolling upgrades?
Despite the tool used for example if the host was using FreeBSD 11.2 and now has been updated to FreeBSD 12, I would like for example just need to run once:
make installworld DESTDIR=/jails/new-base12 SRCCONF=/etc/src-jail.conf
And then per jail either promote (zfs
) or modify a custom /etc/fstab.jailname
(nullfs
) so that once finished I could just do a /etc/rc.d/jails restart
and minimize the downtime.
Any best practice or method to follow, keeping in mind that the goal is to minimize the downtime and if possible simplify as much as possible the upgrade or multiple jails?