I used to go to /var/lib/lxdcontainers and copy files from those containers via cp or Midnight Commander. Now that I move the server to Snap. I can’t find the containers. The ones I find are empty. Like /var/snap/lxd/common/lxd/storage-pools/local/containers/
Figure it out. have to mount it separately via zfs mount local/containers/test2
and then it is in /var/snap/lxd/common/lxd/storage-pools/local/containers/test2
with snap lxd, mounts are done in the namespace of lxd process, so they can’t be found in the caller’s namespace. You have to use nsenter for that, as has been posted many times on this forum. Like that:
sudo nsenter -t $(pgrep daemon.start) -m – du -m -d 2 /var/snap/lxd/common/lxd/storage-pools/default
to check used space.
On a more general point of view, my opinion is that you are going against the grain. The idea of LXD designer on LXD containers is that containers should be seen as small computers. So the best way to access files in containers is to use standard tools like sftp, scp.
It may seem more complex, but it can bring some advantages. If you test a container locally and when it’s done you send it in the cloud, nothing will need to change, while if you use direct disk access it will not work through the network. And if you ever need to use a setup where ZFS is not available, scripts based on standard OS tools will still work. Bonus point: snap lxd is packaging its disk drivers. So if there is some weird incompatibility between snap ZFS and system ZFS, you risk breaking stuff while using system version on snap built disk.
This is what I am doing right now actually, comparing two php.ini one in container vs its backup that is outside of the container. I also like to have backs outside of LXD just in case it crashes, which it does.
Otherwise I try to access containers from within container only for obvious reasons.
I will look into nenter, not familiar with that command.
Why not use
$ lxc file pull cn_name/to/file ./put/here
$ lxc file push file_name cn_name/path/to/where
That is good for moving a hand full of file. But a gui tool is much better for some things. Midnight Commander is wonderful. And I still have other options available. and I say below figured it out.