ZFS Can't mount ZFS dataset with nullfs in a jail

Hello,

I'm trying to mount a newly created dataset into a working jail with nullfs and it does not work.

I run FreeBSD 12.2-RELEASE-p4 on host and in jail. I use jail and jail.conf to run my jails.

In my jail.conf I have:
Code:
allow.mount;
allow.mount.nullfs;
enforce_statfs=1;

I tried with enforce_statfs=0 and with allow.mount.zfs options and it does not work. I even tried with jailed=on on dataset and it does not work.

If I manualy want to mount dataset into jail with mount -t nullfs /zvirt/dir /storage I get mount: /storage: No such file or directory and the dir exists. I checked from the host and with jexec that dir exists and I even made /storage dir with jexec command.

With kldstat nullfs.ko module is loaded.

I tried to mount dataset with mount.fstab option set in jail.conf and I get that dir inside jail does not exist.

What am I missing?

Thanks for all your help.
 
Do the mounting outside of the jail. Create a /etc/fstab.<jailname> for it.

and I get that dir inside jail does not exist.
Make sure your mountpoint actually exists.
 
Do the mounting outside of the jail. Create a /etc/fstab.<jailname> for it.


Make sure your mountpoint actually exists.
I wrote it poorly. I did try to mount it outside the jail with mount.fstab="/jails/fstabs/synct.fstab"; inside /etc/jail.conf and I made the file synct.fstab and I get same results. Directory inside jail does not exist or dataset does not exist. I get one or the other, that is why it is weird. I have made different directories inside the jail and same thing. And yes dir exists(from host and from jail-jexec).

When I get home I will make a new dir in a different jail and with new-new dataset and maybe on a different zpool. I will see if anything changes. I have rebooted the system and tried to mount it... did not work...
 
Make sure you have the right directories.

This is an example from one of my jails:
Code:
root@molly:/usr/ports # cat /etc/fstab.ports
/usr/src                /jails/j-ports/usr/src                  nullfs  ro      0       0
/usr/ports              /jails/j-ports/usr/ports                        nullfs  ro      0       0
/usr/ports/distfiles    /jails/j-ports/usr/ports/distfiles      nullfs  ro      0       0
/usr/local/poudriere/data       /jails/j-ports/data             nullfs  ro      0       0
/storage/release        /jails/j-ports/storage/release          nullfs  ro      0       0
/storage/release/13-stable      /jails/j-ports/storage/release/13-stable                nullfs  ro      0       0
Note that the destinations are from the host's point of view, not the jail.
 
Yes, this might be the problem. I made it from jails point of view. Will try when I get home and report if this is it. Did not think of it.

EDIT: Just tested it and it works like a charm :)

Thank you.
 
Back
Top