lxc config file reverting

Discussion in 'Proxmox VE: Installation and configuration' started by jjjman321, Feb 11, 2019.

  1. jjjman321

    jjjman321 New Member

    Joined:
    May 23, 2018
    Messages:
    4
    Likes Received:
    0
    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
     
  2. jjjman321

    jjjman321 New Member

    Joined:
    May 23, 2018
    Messages:
    4
    Likes Received:
    0
    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.
     
    #2 jjjman321, Feb 11, 2019
    Last edited: Feb 11, 2019
  3. jim.bond.9862

    jim.bond.9862 Member

    Joined:
    Apr 17, 2015
    Messages:
    291
    Likes Received:
    20
    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>
     
  4. oguz

    oguz Proxmox Staff Member
    Staff Member

    Joined:
    Nov 19, 2018
    Messages:
    158
    Likes Received:
    13
    You need to edit /etc/pve/lxc/CTID.conf instead.

    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. jjjman321

    jjjman321 New Member

    Joined:
    May 23, 2018
    Messages:
    4
    Likes Received:
    0
    Great info - thank you.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice