lxc config file reverting

jjjman321

New Member
May 23, 2018
6
0
1
52
Hi - new to Debian and linux in general so I'm not able to intelligently Google this issue effectively.

I've got an NFS network share to which an LXC container needs persistent access. The share is mounted in the Proxmox host (in /mnt/dataElsewhere), and I enter this line:

lxc.mount.entry = /mnt/dataElsewhere /var/lib/lxc/101/rootfs/mnt/dataElsewhere none bind 0 0

into /var/lib/lxc/101/config (where 101 is the container number) config file on the host Proxmox.

Of course I also have a /mnt/dataElsewhere in the container. Works great until the container restarts, and I see the dataElsewhere directory is still there in the container but nothing in it - and the host config file no longer has the lxc.mount.entry line.

Any idea what's going on? I might be on a totally wrong track on how to solve my root issue, mounting in a container.
Thanks
 
I just noticed that, once the container is shut down, if I start it again via the ProxMox GUI, the config file in the host reverts and I don't have the mount in the container - but if I start the container via:
lxc-start -n 101 -d
in a shell/SSH on the host, it maintains the mount in the container.

Edit - well I take that back. It seems to be random whether it mounts or not. Strange.
 
Last edited:
Well I do it a bit differently in my setup.
Since you already the share mount it on host. Just edit the lxc config directly and add the bind mount there.
Buy make sure you remove the folder in containers /mnt. The mount point will be created automatically.
Search here for proper syntax
It gose somethig like mp0: <your host folder>,<your loc folder>
 
into /var/lib/lxc/101/config (where 101 is the container number) config file on the host Proxmox.

You need to edit /etc/pve/lxc/CTID.conf instead.

I just noticed that, once the container is shut down, if I start it again via the ProxMox GUI, the config file in the host reverts and I don't have the mount in the container - but if I start the container via:
lxc-start -n 101 -d
in a shell/SSH on the host, it maintains the mount in the container.

The correct way of starting containers in Proxmox is either through the GUI, or with our tool `pct`.
Those two will take the config from /etc/pve/lxc/CTID.conf and all the changes you make there will persist.
 
  • Like
Reactions: Steveuk

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!