Re:_I_can_get_zfs_snapshot/rollback_in_a_jail_to_work_ 99%_but_it_isn't_quite_100% _working._What_am_I_missing?

From: DtxdF <DtxdF_at_disroot.org>
Date: Tue, 07 Nov 2023 04:48:01 UTC
> So as I mentioned I’ve able to mail the dataset. It gets mounted upon starting the jail. It shows up in “zfs list”.

If you can see your dataset with `zfs-list(8)` it does not mean that it is mounted. You should check it using `mount -t zfs` or `zfs mount`.

> And when I do zfs snapshot on the dataset it appears to create the snapshot as it shows up in a “zfs list -t snapshot” but the snapdir isn’t visible even after setting snapdir to visible, and when I rollback using the snapshot it doesn’t actually rollback.

You can create snapshots and run `zfs-rollback(8)` even when your dataset is not mounted and it will not fail.

---

I have seen your `rc.conf(5)` from your jail and it sets `zfs_enable` to `YES`. As I mentioned, it doesn't work at startup and maybe it's a bug. When your jail is started you can run `service zfs start` and it will work. That rc script knows it is inside a jail so it just runs `zfs mount -a` and `zfs umount -a` (when running `service zfs stop`).

I don't recommend using that rc script to mount your datasets because when you run `service zfs stop` it will try to unmount `/` which is an error. As a workaround use the approach I share with you: mount and unmount your datasets using your `jail.conf(5)` (see the AppJail template example).