[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ezjail] zfs datasets won't automount inside jail

W dniu 2015-04-22 o 10:47, patpro AT patpro DOT net pisze:

> On 22 avr. 2015, at 10:31, Vedad KAJTAZ <vedad AT kajtaz DOT net> wrote:
>> You're being lucky if the above works. It will randomly fail.
>> The issue is that zfs datasets are being linked to the jail from the host system (ezjail issues the "zfs jail <id> <dataset>" command) after the jail startup (since the above command requires the jail id), that is, after the jail_MYJAIL_exec_start is fired from within the jail.
>> The only rock solid working solution is to write a jail startup script (jail_MYJAIL_exec_start) that will wait for the zfs datasets to appear (eg. by checking the "zfs list" output in a while/sleep loop) before issuing the zfs mount command (unless you have zfs_enable="YES" set in rc.conf, then it will implicitly mount), and before running the /etc/rc script.
> In fact, I've tried zfs_enable="YES" in my jail's /etc/rc.conf, but it would not work at all (100% failure across reboots).
> I guess I'm going to write a script to handle all this mess :)
> I'll have to create a total of 11 jails, I don't want something randomly failing in the event of a reboot.

I'm using this script on host:


# $Id: jailmount_zfs 598 2013-02-06 10:06:03Z idaho $

# PROVIDE: jailmount_zfs
# REQUIRE: ezjail

. /etc/rc.subr



        jls jid | xargs -oI% jexec % service zfs start >/dev/null

load_rc_config $name
: ${jailmount_zfs_enable:=no}

load_rc_config $name
run_rc_command "$1"

best regards,
Lukasz Wasikowski