[lxc-users] access to snapshots from within the containers

Michel Jansens michel.jansens at ulb.ac.be
Tue Jun 13 12:37:59 UTC 2017


Hi all,

I’m busy discovering LXD v2.0.9 on Ubuntu 16.04
I’m trying to access the (ZFS) snapshots data from within containers.

I’ve shared the “.zfs/snapshot” directory with the associated container like this: 
lxc config device add obliging-panda snapshot disk path=/snapshot source=/var/lib/lxd/containers/obliging-panda.zfs/.zfs/snapshot

From inside the container, I see the list of snapshots:

root at obliging-panda:/snapshot# ls -l /snapshot/
total 2
drwxr-xr-x 4 root   root    5 May 23 09:12 snapshot-2017_06_12_08h56
drwxr-xr-x 4 root   root    5 May 23 09:12 snapshot-2017_06_13_09h06
drwxr-xr-x 4 root   root    5 May 23 09:12 snapshot-abcd
dr-xr-xr-x 1 nobody nogroup 0 Jun 13 07:11 snapshot-newsnap
drwxr-xr-x 4 root   root    5 May 23 09:12 snapshot-test

But they all look inaccessible:
root at obliging-panda:/snapshot# ls -l /snapshot/snapshot-newsnap/rootfs
ls: cannot access '/snapshot/snapshot-newsnap/rootfs': Object is remote


…until you list them in the main Server 

ls  /var/lib/lxd/containers/obliging-panda.zfs/.zfs/snapshot/snapshot-newsnap/rootfs/

Then they appear in the container:

root at obliging-panda:/snapshot# ls -l snapshot-newsnap/rootfs
total 99
drwxr-xr-x  2 root root 173 Jun 12 12:01 bin
drwxr-xr-x  3 root root   3 May 16 14:19 boot
drwxr-xr-x  5 root root  91 May 16 14:18 dev
...

The funny thing, is that this same weird behaviour  happened a long time ago in Solaris zones… so I imagine this has to do with ZFS…



Is there another more “standard" way to access snapshots?
I saw there is a  /snap (empty) directory in the containers. Is it meant to access snapshots? if yes how do you have them mounted?

Sorry if there is something obvious I’m missing. I’m new to Ubuntu/LXD (coming from Solaris & SmartOS zones).

Thanks.

Michel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170613/02f37b7f/attachment.html>


More information about the lxc-users mailing list