Hi Forum,
Don't know if this right place to ask, this is a question regarding to zfs in jail and auto mount.
I created a jail to install mysql database, and database data folder on zfs. So on host: I created zfs and set jailed=on.
Now I installed jail, and on host I run [cmd=]zfs jail <jid> tank/data/mysql[/cmd] to export zfs to jail, and inside jail, I run [cmd=]zfs mount -a[/cmd] and set dbdir of mysql to /mnt/tank/data/mysql. So far so good.
Now the problem is automate. I want my jail start during system boot. So db jail been added into host's /etc/rc.conf. And I need a poststart script to run [cmd=]_jail_id = $(cat /var/run/jail_db.id)[/cmd] and then [cmd=]zfs jail ${_jail_id} tank/data/mysql[/cmd]
I had to put it into poststart, because before that, there's no JID. But poststart means jail already started (include all services), and mysql already started and using /mnt/tank/data/mysql, which not a zfs mount as data dir. so /mnt/tank/data/mysql is cannot mounted in db jail.
I believe this is common usage of zfs in jail, so I must did something wrong. probably not in poststart? Any tip?
Thanks a lot
Noodle
Don't know if this right place to ask, this is a question regarding to zfs in jail and auto mount.
I created a jail to install mysql database, and database data folder on zfs. So on host: I created zfs and set jailed=on.
Now I installed jail, and on host I run [cmd=]zfs jail <jid> tank/data/mysql[/cmd] to export zfs to jail, and inside jail, I run [cmd=]zfs mount -a[/cmd] and set dbdir of mysql to /mnt/tank/data/mysql. So far so good.
Now the problem is automate. I want my jail start during system boot. So db jail been added into host's /etc/rc.conf. And I need a poststart script to run [cmd=]_jail_id = $(cat /var/run/jail_db.id)[/cmd] and then [cmd=]zfs jail ${_jail_id} tank/data/mysql[/cmd]
I had to put it into poststart, because before that, there's no JID. But poststart means jail already started (include all services), and mysql already started and using /mnt/tank/data/mysql, which not a zfs mount as data dir. so /mnt/tank/data/mysql is cannot mounted in db jail.
I believe this is common usage of zfs in jail, so I must did something wrong. probably not in poststart? Any tip?
Thanks a lot
Noodle