ZFS and Jail :: nullfs mount :: nothing visible from host

SK fbstable at cps-intl.org
Thu Dec 8 14:29:43 UTC 2016


Hello

I am trying to set up a bunch of jails (vimage, vtnet) on FreeBSD 11 Stable.

I have created a tank/Jail dataset, and created mroot and other staff 
inside that (regular folders)

The jails are using those folders using nullfs -- so far so good.

I also have a few zfs datasets, like tank/users, tank/emails and so on 
which are null-mounted inside the jail

a typical fstab.jail looks like below
# Device MountPoint                              FSType  Options Dump Pass
/jails/mroot /jails/testJail                         nullfs  ro      
0       0
/jails/RWs/testJail /jails/testJail/RWs                     nullfs  
rw      0       0

### zfs nullmount
/tank/users /JailS/RWs/testJail/users        nullfs  rw      0       0
/tank/emails /JailS/RWs/testJail/emails        nullfs  rw      0       0


### for Bash etc
#Device         MountPoint      FSType  Options Dump Pass
fdesc           /dev/fd         fdescfs rw      0       0
proc            /proc           procfs  rw      0       0


Now, I am able to write files into /mails and /users, and they are 
visible from within the jail. From the host -- these datasets are all empty!

ls -lah /tank/users shows no files in them, even though from within the 
jail I can see that there are many folders available. This makes 
managing them from the host a bit difficult. And I have not been able to 
find any good documentation that can outline how I can setup zfs so I 
can manage it from within the jails.

What I would really like to do is to have the zfs inside the jail, and 
be able to create snapshots, use other features, etc. Failing to do 
that, I should at least be able to do it from the host. But I cannot 
find any good pointer (I had been searching for quite some time now -- 
maybe my search skills are not that good) which can help in setting 
things up that way.

I found one document that hinted that I might be able to achieve this 
using ezjail, but I would prefer to do it the "raw" way, i.e., use the 
base features with as little from ports as possible. I am using 
vtnet/vimage, so all my jails are currently on a different subnet than 
the lan and they are working alright except for this disc management issue.

Final goal is to have samba running on one final jail, using zfs and 
managing zfs features from within the jail, so that I can create 
datasets as needed and take snapshots, make clones, etc.

So far I have tried to follow as many google results as possible using 
jail, zfs, mountpoint, nullfs, manage zfs and so on. There were a few 
sites coming up again and again but they were talking about ezjail (not 
that I have anything against it, but I would prefer to be able to use 
the base system as it is -- might help me learn a few things that ezjail 
will hide from me :D)

Any good how-to/documentation/pointer will be greatly appreciated.

Thanks and regards
SK


More information about the freebsd-jail mailing list