How can I access data of one LXC container from an other container?

gno

Member
Sep 4, 2023
20
3
8
Hello,

I have a privileged LXC-103 that acts as fileserver.
The files are stored on a ZFS subvol and provided to the users (family) by NFS.

Code:
root@pve2:~# cat /etc/pve/lxc/103.conf
...
features: mount=nfs;cifs,nesting=1
hostname: srv
mp0: r1samsung2tb:subvol-103-disk-0,mp=/mnt/srv_data0,backup=1,size=600G
rootfs: r1samsung480gb:subvol-103-disk-0,size=8G

In the unprivileged LXC-125 runs Paperless (without Docker) whose data is currently stored in /opt/paperless/media and /opt/paperless/data

Code:
root@pve2:~# cat /etc/pve/lxc/125.conf
...
features: nesting=1
hostname: paperless
rootfs: r1samsung480gb:subvol-125-disk-0,size=4G
unprivileged: 1

Now I want to move the two paperless directories to the fileserver to have everything in one place.
The directories then should be accessible per NFS by the users and of course by paperless in LXC-125.

What is the best way to achieve that?
 
Move the files from the paperless host to the NFS shares using rsync or scp, then mount the NFS shares to the paperless host via /etc/fstab onto the paperless directories.

You probably will have to fiddle with file permissions and owner mappings during migration.
 
That doesn't work for me

From the unprivileged container LXC-125
Code:
sudo mount -t nfs srv.domain.net:/srv/paperless /mnt

From my Laptop I can access the share with the same command
 
I think NFS (or SMB) mounts from inside a unprivileged container don't work (but I might be wrong!). Usually you mount shares on the Proxmox host and pass them to containers using mountpoints.
Alternatively, you might create a filesystem or chose a directory on the host as a shared space, and pass it to multiple containers (on the same Proxmox host) using mountpoints.
EDIT: Sorry, I just read your post and saw that you want to use NFS, so a local shared space does not apply.
 
Last edited:
I think bind mounts are used to access data from external devices that are mounted on the pve host.

I want to acces data that is stored on an other container's ZFS subvolume. See my first post
 
Bind mounts can do both things, as long as the containers are on the same Proxmox. And even in a cluster there are some ways to do it, I think.

EDIT: Just treat the other container's ZFS subvolume as the "external device" and bind mount to it via a mountpoint. Or move the ZFS subvolume out of the container (by renaming it and editing the container configuration) and bind mount it in both containers using a mountpoint.
 
Last edited:
  • Like
Reactions: Johannes S