# Jail mounting issue



## mariourk (Nov 2, 2017)

Hi,

I have a few jails running on a new server. This works really well and I'm quite happy with the whole setup. Jails are a very powerfull tool, that much is clear. However, there is one jail that gives me an annoying problem.

I use ezjail-admin to manage all my jails and I like the tool a lot. I installed all the jails in the standard /usr/jails directory with all the power of ZFS that ezjail-admin provides (on the standard zroot, that the FreeBSD installation wizard provides). All jails, except for one. And that one jail is giving me problems.

That jail is running a webserver, that hosts Nextcloud. I needed more than usual storage for this setup, so I put it on a seperate ZFS-pool, with larger drives.

`ezjail-admin create -r /Storage/jails/nextcloud.jail nextcloud.jail 123.123.123.123`

The problem is that when I reboot the (physical) server, something goes wrong when mounting that ZFS-partition. For some reason it gets mounted correct and than it gets mounted again a second time, with an empty partition or something. That causes the partition where the jail is stored appear to be empty. And that gives me a jail that doesn't start.

The remedy to this problem is easy. I simply do an umount on that partition.

`umount /Storage/jails/nextcloud.jail`

This makes all the files magically re-appear again and now I can start the jail without any problems. So it itsn't a big issue perse. It's just really annoying. And it could become a problem when someone else, who doesn't know about this, needs to do a reboot. It's just sloppy. And it bugs me.

Any advice on how to make this work smooth?

Thanks in advance


----------



## SirDice (Nov 2, 2017)

I think it's the other way around. Your files are actually stored in the directory (the mount point) and mounting the file system on that directory hides those files and shows you an empty filesystem. This can happen if you created those files after a failed mount.


----------



## mariourk (Nov 6, 2017)

I did create /Storage/jails by hand. But /Storage/jails/nextcloud.jail was created bij ezjail-admin. One would assume that wouldn't trigger a mess with double mounts.

What I was thinking. Is it possible to execute a script when ezjal-admin tries to start a jail? I could do a simple check to see if /Storage/jails/nextcloud.jail is empty. And if it is, run an umount first, before ezjail-admin attempts to start the jail. It's a crude solution. But also a simple one. And probably one that will work.

If someone knows a better solution, I'm all ears.


----------

