When performing zfs perambulations after install (as noted in
ZFS and NAStie and i386 and not reading the specification),
the chance of finger fumbling errors is high. To prevent those errors,
I modified the zfsinstall script included in the mfsBSD 8.2-RELEASE-p2
ISO to configure the paths to different dataset objects as described on
the FreeBSD Wiki.
A patch is available for future use/reference, and the contents of the patch are displayed below.
--- zfsinstall.original 2011-11-26 14:48:37.000000000 -0500
+++ zfsinstall 2011-11-26 14:53:19.000000000 -0500
@@ -4,7 +4,7 @@
# mfsBSD ZFS install script
# Copyright (c) 2011 Martin Matuska <mm at FreeBSD.org>
#
-FS_LIST="var tmp"
+FS_LIST="home tmp usr usr/ports usr/ports/distfiles usr/ports/packages usr/src var var/crash var/db var/db/pkg var/empty var/log var/mail var/run var/tmp srv"
usage() {
echo "Usage: $0 [-h] -d geom_provider [-d geom_provider ...] -t archive_file [-r mirror|raidz] [-m mount_point] [-p zfs_pool_name] [-V zfs_pool_version] [-s swap_partition_size] [-z zfs_partition_size] [-c] [-l] [-4]"
@@ -275,16 +275,40 @@
echo " ... done"
echo -n "Creating ${POOL} partitions:"
for FS in ${FS_LIST}; do
+ ZFSOPTS=""
if [ "${LEGACY}" = 1 ]; then
MNTPT="-o mountpoint=legacy"
else
MNTPT=
fi
- if ! /sbin/zfs create ${MNTPT} ${POOL}/root/${FS} > /dev/null 2> /dev/null; then
+ # Added to follow http://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror
+ case "${FS}" in
+ home|usr|var)
+ ZFSOPTS=""
+ ;;
+ srv|usr/src|var/crash|var/log|var/mail)
+ ZFSOPTS="-o compression=lzjb -o exec=off -o setuid=off"
+ ;;
+ tmp|var/db/pkg|var/tmp)
+ ZFSOPTS="-o compression=lzjb -o exec=on -o setuid=off"
+ ;;
+ usr/ports)
+ ZFSOPTS="-o compression=lzjb -o setuid=off"
+ ;;
+ usr/ports/distfiles|usr/ports/packages)
+ ZFSOPTS="-o compression=off -o exec=off -o setuid=off"
+ ;;
+ var/db|var/empty|var/run)
+ ZFSOPTS="-o exec=off -o setuid=off"
+ ;;
+ esac
+ # Added ZFSOPTS to follow http://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror
+ if ! /sbin/zfs create ${MNTPT} ${ZFSOPTS} ${POOL}/root/${FS} > /dev/null 2> /dev/null; then
echo " error"
exit 1
fi
echo -n " ${FS}"
+
done
echo " ... done"
echo -n "Setting bootfs for ${POOL} to ${POOL}/root ..."
@@ -313,6 +337,10 @@
echo " done"
fi
+# Added to follow http://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror
+chmod 1777 ${MNT}/tmp
+chmod 1777 ${MNT}/var/tmp
+
echo -n "Extracting FreeBSD distribution ..."
if [ "${DIRECT_TAR}" = "1" ]; then
if ! /usr/bin/tar -C ${MNT} -x -f ${ARCHIVE} > /dev/null 2> /dev/null; then
@@ -395,6 +423,9 @@
echo "Error mounting devfs on ${MNT}/dev"
fi
+# Added to follow http://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror
+zfs set readonly=on ${POOL}/root/var/empty
+
echo ""
echo "Installation complete."
echo "The system will boot from ZFS with clean install on next reboot"