summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xezjail-admin15
-rwxr-xr-xezjail.conf.sample3
2 files changed, 14 insertions, 4 deletions
diff --git a/ezjail-admin b/ezjail-admin
index 55311ac..55c6e6e 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -392,6 +392,9 @@ parse_gbde_attach_args () {
392} 392}
393 393
394check_for_zfs () { 394check_for_zfs () {
395 # check if the ezjail zfs has been specified
396 [ -n "${ezjail_jailzfs}" ] || exerr "Error: The variable ezjail_jailzfs needs to point a zfs ezjail can work in.\n Set it in your ezjail.conf."
397
395 # check the ZFS version 398 # check the ZFS version
396 _zfs_version=`sysctl -nq vfs.zfs.version.spa` 399 _zfs_version=`sysctl -nq vfs.zfs.version.spa`
397 [ -z "${_zfs_version}" -o "${_zfs_version}" -lt 13 ] && exerr "Error: ZFS is not loaded or your ZFS version is not supported." 400 [ -z "${_zfs_version}" -o "${_zfs_version}" -lt 13 ] && exerr "Error: ZFS is not loaded or your ZFS version is not supported."
@@ -471,14 +474,18 @@ create)
471 # we need at least a name and an ip for new jail 474 # we need at least a name and an ip for new jail
472 [ "${ezjail_name}" -a "${ezjail_ips}" -a $# -eq 2 ] || exerr ${ezjail_usage_create} 475 [ "${ezjail_name}" -a "${ezjail_ips}" -a $# -eq 2 ] || exerr ${ezjail_usage_create}
473 476
474 # check for an active ZFS zpool
475 [ "${ezjail_imagetype}" = "zfs" ] && check_for_zpool
476
477 # check for sanity of settings concerning the image feature 477 # check for sanity of settings concerning the image feature
478 if [ "${ezjail_imagetype}" != "zfs" ]; then 478 if [ "${ezjail_imagetype}" != "zfs" ]; then
479 [ -z "${ezjail_imagetype}" -o "${ezjail_exists}" -o "${ezjail_imagesize}" ] || exerr "Error: Image jails need an image size." 479 [ -z "${ezjail_imagetype}" -o "${ezjail_exists}" -o "${ezjail_imagesize}" ] || exerr "Error: Image jails need an image size."
480 fi 480 fi
481 481
482 # If user wants jails to be in zfs by default, and did not override it on
483 # the command line, make the jail a zfs one
484 [ "${ezjail_use_zfs_for_jails}" = "YES" -a ! "${ezjail_imagetype}" ] && ezjail_imagetype=zfs
485
486 # check for an active ZFS zpool
487 [ "${ezjail_imagetype}" = "zfs" ] && check_for_zpool
488
482 # check for a sane image type 489 # check for a sane image type
483 case ${ezjail_imagetype} in ""|simple|bde|eli|zfs) ;; *) exerr ${ezjail_usage_create};; esac 490 case ${ezjail_imagetype} in ""|simple|bde|eli|zfs) ;; *) exerr ${ezjail_usage_create};; esac
484 491
@@ -617,7 +624,7 @@ create)
617 ;; 624 ;;
618 zfs) 625 zfs)
619 if [ -z "${ezjail_exists}" ]; then 626 if [ -z "${ezjail_exists}" ]; then
620 [ -n "${ezjail_imagesize}" ] && ezjail_zfs_jail_properties="-o quota=${ezjail_imagesize} -o compression=lzjb" 627 [ "${ezjail_imagesize}" ] && ezjail_zfs_jail_properties="${ezjail_zfs_jail_properties} -o quota=${ezjail_imagesize}"
621 [ -d "${ezjail_jaildir}/${ezjail_hostname}" ] && exerr "Error: Could not create jail root mount point ${ezjail_rootdir}" 628 [ -d "${ezjail_jaildir}/${ezjail_hostname}" ] && exerr "Error: Could not create jail root mount point ${ezjail_rootdir}"
622 629
623 /sbin/zfs create -o mountpoint=${ezjail_rootdir} ${ezjail_zfs_jail_properties} ${ezjail_jailzfs}/${ezjail_hostname} 630 /sbin/zfs create -o mountpoint=${ezjail_rootdir} ${ezjail_zfs_jail_properties} ${ezjail_jailzfs}/${ezjail_hostname}
diff --git a/ezjail.conf.sample b/ezjail.conf.sample
index 5d3bbe2..1815486 100755
--- a/ezjail.conf.sample
+++ b/ezjail.conf.sample
@@ -52,7 +52,10 @@
52 52
53# Setting this to YES will start to manage the basejail and newjail in ZFS 53# Setting this to YES will start to manage the basejail and newjail in ZFS
54# ezjail_use_zfs="YES" 54# ezjail_use_zfs="YES"
55# Setting this to YES will manage ALL new jails in their own zfs
56# ezjail_use_zfs_for_jails="YES"
55# The name of the ZFS ezjail should create jails on, it will be mounted at the ezjail_jaildir 57# The name of the ZFS ezjail should create jails on, it will be mounted at the ezjail_jaildir
56# ezjail_jailzfs="tank/ezjail" 58# ezjail_jailzfs="tank/ezjail"
57# ADVANCED, be very careful! 59# ADVANCED, be very careful!
58# ezjail_zfs_properties="-o compression=lzjb -o atime=off" 60# ezjail_zfs_properties="-o compression=lzjb -o atime=off"
61# ezjail_zfs_jail_properties="-o dedup=on"