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

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



Hi Lukasz,

On 22 avr. 2015, at 10:51, Łukasz Wąsikowski <lukasz AT wasikowski DOT net> wrote:

>> 
>> 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:
> 
> #!/bin/sh
> 
> # $Id: jailmount_zfs 598 2013-02-06 10:06:03Z idaho $
> 
> # PROVIDE: jailmount_zfs
> # REQUIRE: ezjail
> 
> . /etc/rc.subr
> 
> name="jailmount_zfs"
> rcvar=jailmount_zfs_enable
> 
> start_cmd="${name}_start"
> poll_cmd=":"
> restart_cmd="${name}_start"
> 
> jailmount_zfs_start()
> {
>        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"


This script looks great. I guess it's executed after jail_MYJAIL_exec_start="/bin/sh /etc/rc", is that correct? And I guess it would not get triggered if I do a manual jail (re)start (ezjail-admin ...).

thanks,
Patrick