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

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

El 20/04/2015 a las 14:28, patpro AT patpro DOT net escribió:

After about 15 years spent playing with FreeBSD, I'm trying Jails for the first time. I've chosen ezjail and i'm quite happy about it but I'm facing strange issues.
For example, I'm not able to automount ZFS dataset inside the jail. I have to issue "zfs mount -a" from within the jail, and then it's all OK. In order to automount, I've edited the _exec_start command so that it sends the mount request when the jail starts:

export jail_MYJAIL_exec_start="/bin/sh /etc/rc & zfs mount -va"

And it works great, so far.

Is there any better way/best practice to achieve this?


Hi Patrick,

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.

Kind regards,


Attachment: smime.p7s
Description: Firma criptográfica S/MIME