View .zfs/snapshot inside container

Can you browse and restore individual files from snapshots without rolling back the entire container? Through .zfs/snapshot or another way?

I’ve been using samba+vfs_shadow_copy2 (to integrate with VSC on Windows) without LXD. Now I’m trying to move this inside a container, but can’t find any way of getting the .zfs/snapshot directories.

I’m on LXC 3.14. Thanks for any help you can provide!

In theory you could try to expose the magic directory using a disk device, setting the source to the host path for it. But it’s worth remembering that this is a weird magic path, so you may have some pretty odd behavior accessing it.

Also, keep in mind that the uid/gid of files in snapshots may be completely wrong as containers can change maps at times. LXD handles that fine on restores or copies as it knows what the uid/gid map of a given snapshot is and can translate the uid/gid information, but that’s not something you can do on the fly by passing the magic directory through.

Done

:slight_smile:

I’ve only just discovered this shortcoming with LXD and ZFS snapshots.

Today I noticed a single (hidden) file was missing from one of my LXD containers

“No problem!” I thought “I’ll just mount the dataset then I’ll be able retrieve the file from the .zfs dir”

Nope! All of the .zfs/snapshots subdirs are empty :frowning:

Very disappointing. Is this yet another side effect / downside of LXD using snaps under Ubuntu? I wonder if this works OK with LXD under Debian or any other OS not blighted by snaps?

Please fix this if you can. Can you tell I DO NOT like snap packages?