Jails on ZFS

Artis Caune artis.caune at gmail.com
Tue Jul 28 18:34:50 UTC 2009


2009/7/28 Alexander Petrovsky <askjuise at gmail.com>:
> Hi, it is may be good idea. But, I can't understand your code, why you do -
>  umount ${_dir} >/dev/null 2>&1 || { sleep 2; umount ${_dir} >/dev/null 2>&1
> || umount -f ${_dir} >/dev/null 2>&1; }
>
> instead
>  umount ${_dir} >/dev/null 2>&1 || umount -f ${_dir} >/dev/null 2>&1
>
> ?

Because when jail is shuting down, file system is still busy. I think
this is because of syslogd, which has no rc.d shutdown keyword, and so
it's been killed. Immediately after killing all jail processes, file
systems are unmounted.
It helps sleeping 1, 2 seconds and then trying to unmount it, and if
fs is still busy, force unmount it.


Maybe this is better:

--- /etc/rc.d/jail	2009-07-22 23:29:29.000000000 +0300
+++ /etc/rc.d/jail	2009-07-28 21:23:30.436217867 +0300
@@ -270,7 +270,7 @@
 	_dir=$1

 	if is_current_mountpoint ${_dir}; then
-		umount -f ${_dir} >/dev/null 2>&1
+		umount ${_dir} >/dev/null 2>&1 || umount -f ${_dir} >/dev/null 2>&1
 	else
 		debug "Nothing mounted on ${_dir} - not unmounting"
 	fi
@@ -700,6 +700,7 @@
 				killall -j ${_jail_id} -TERM > /dev/null 2>&1
 				sleep 1
 				killall -j ${_jail_id} -KILL > /dev/null 2>&1
+				sleep 2
 				jail_umount_fs
 				echo -n " $_hostname"




-- 
Artis Caune

    Everything should be made as simple as possible, but not simpler.


More information about the freebsd-jail mailing list