Solved mount zfs dataset


I run a few jail withing FreeBSD 10.1 and I have some backup script that run in every jails.
I have created a zfs dataset and the aim is to mount this backup point in every jails to they all save to it
sudo zfs create -o compression=lz4 zroot/DATA/backups
. On the host, I then send all the single backup off site in 1 go..
I tried zfs set mountpoint but realised that I can only mount 1 jaik using this..
Is it possible to use mount_nullfs to do this?
When I tried it failed with
mount_nullfs: /zroot/tmp/zroot: No such file or directory
Can't see why this shouldn't be possible.
You need to create and mount the dataset on the host first.
# zfs create -o mountpoint=/backups zroot/DATA/backups

Then you should be able to use nullfs to mount /backups to a path under the jails

# mount -t nullfs /backups /jail1/backups
# mount -t nullfs /backups /jail2/backups

The only issue is that all systems have access to each others backups which isn't ideal if something goes wrong, or a jail gets compromised. I'd at least suggest taking snapshots of the backup dataset on the host, or regularly sending the backups to a separate system.
ZFS is not a clustered FS. Therefore, any attempt to access it at the same time from different machines or hosts, would have unexpected outcome.
I think you're trying to do your backups backwards. You should instead run the backup on the host where all the jails are visible (being the host where the jail datasets are mounted) and you don't have to run anything unsecure on the jails.