Starting LXC Container with bind mount changes the owner of that mount on the filesystem

smacz

Active Member
May 19, 2018
2
0
41
35
Hello all,

I have the following configuration (and similar like it) for a lot of my LXC containers:
Code:
./209.conf:mp0: /mnt/glusterfs/hub-volume/andrewcz-org/firefly-importer_uploads,mp=/var/lib/firefly-importer/data/storage/uploads
./209.conf:mp1: /mnt/glusterfs/hub-volume/andrewcz-org/firefly-importer_configurations,mp=/var/lib/firefly-importer/data/storage/configurations

They are on a glusterfs share (yes, I know it's deprecated, don't come at me about it - I'm not using it as an integration, just standalone shared filesystem), with permissions of a user somewhere in the 10000+ range because of remapping, so that it will match the uid of the user inside of the container.

Code:
root@hub-proxmini02:/etc/pve/lxc# ls -l /mnt/glusterfs/hub-volume/andrewcz-org/firefly-importer_configurations -a
total 8
drwxr-xr-x  2 109014 109014 4096 Dec 21 14:30 .

However, whenever I start up a container with a mountpoint like this, the permission of ONLY the top-level directory gets changed to 10000.

Is that by design somewhere, or is there something about my mount point configuration that's missing?

This is really throwing me off, as I am having to re-set permissions every time that I stop/start a container.
 
I'm not quiet sure I understood your question, if I didn't please correct me. If by top-level directory you mean firefly-importer_uploads in /mnt/glusterfs/hub-volume/andrewcz-org/firefly-importer_uploads. And every other parent directory keeps it's owner, ie after starting the container the permissions of your directory tree look like this:

Code:
$ find /mnt/glusterfs/ -maxdepth 3 -printf '%U:%G %n\n'
0:0 /mnt/glusterfs
0:0 /mnt/glusterfs/hub-volume
0:0 /mnt/glusterfs/hub-volume/andrewcz-org
100000:100000 /mnt/glusterfs/hub-volume/andrewcz-org/firefly-importer_uploads
100000:100000 /mnt/glusterfs/hub-volume/andrewcz-org/firefly-importer_configurations

then yes, that is expected behavior. Since you are only mounting the directory /mnt/glusterfs/hub-volume/andrewcz-org/firefly-importer_uploads into the container, and not it's parent /mnt/glusterfs/hub-volume/andrewcz-org.