How To Use beadm to Upgrade FreeBSD installed in a ZFS Boot Environment, with minimal downtime

Starting the jail

To start the jail, simply use the FreeBSD jail command, passing it the configuration file we just created.

/usr/sbin/jail -f /jails/devel/jail.conf -c freebsd-zfs-devel
freebsd-zfs-devel: created

Note:  -f, tells it the configuration file to use instead of the default, and -c specifies the jails name within the configuration file.

I prefer to use a script that does this for me, I have the following code saved in a file /jails/devel/jail.sh on my systems, I can simple change to the /jails/devel directory and call ./jail.sh start to start the jail and not need to type the full command. It also uses the current host name, to determine the name so I can use the script for multiple servers without editing it.

#!/bin/sh
HOSTNAME=`/bin/hostname -s`
DEVELNAME=${HOSTNAME}'-devel'
JAILDIR='/jails/devel/'
JAILCONF=${JAILDIR}jail.conf
case ${1} in
 [sS][tT][aA][rR][tT])
   /usr/sbin/jail -f ${JAILCONF} -c ${DEVELNAME}
  ;;
 [sS][tT][oO][pP])
   /usr/sbin/jail -f ${JAILCONF} -r ${DEVELNAME}
  ;;
 *)
   echo ${0}' Requires one of [start|stop]'
   echo '   start runs: /usr/sbin/jail -f '${JAILCONF}' -c '${DEVELNAME}
   echo '   stop runs:  /usr/sbin/jail -f '${JAILCONF}' -r '${DEVELNAME}
  ;;
esac