Proxmox 4.0 - sharing folders via lxc.mount.entry

Discussion in 'Proxmox VE: Installation and configuration' started by chadc, Jul 4, 2015.

  1. chadc

    chadc New Member

    Joined:
    Jul 4, 2015
    Messages:
    3
    Likes Received:
    0
    #1 chadc, Jul 4, 2015
    Last edited: Jul 4, 2015
  2. chadc

    chadc New Member

    Joined:
    Jul 4, 2015
    Messages:
    3
    Likes Received:
    0
    Here is my config for 101:

     
  3. chadc

    chadc New Member

    Joined:
    Jul 4, 2015
    Messages:
    3
    Likes Received:
    0
    Problem solved - I removed the forward slash from the container mount point, e.g.

    lxc.mount.entry = /data/nas data none bind,create=dir 0 0

    Thanks to everyone who looked.
     
  4. haxxa

    haxxa New Member

    Joined:
    Jun 26, 2015
    Messages:
    29
    Likes Received:
    1
    Thanks, I was dealing with this for 2 hours until I saw your post to remove slash.
     
  5. macroonline

    macroonline New Member

    Joined:
    Sep 15, 2015
    Messages:
    2
    Likes Received:
    0
    Hi.
    Can anybody help to mount more than one host directory into lxc container?
    I've installed last Proxmox VE 4.0 beta2.
    When i trying to add more than one entry (one of):
    or
    I just got first of configured mounts accessible in LXC container.

    I've also checked with lxc.mount.hook that two directories mounted to $LXC_ROOTFS_MOUNT before root_pivot:
    Is it possible to mount two host folders to container?
     
  6. sigxcpu

    sigxcpu Member

    Joined:
    May 4, 2012
    Messages:
    433
    Likes Received:
    9
    All I can say is that it works for me:

    Inside the container:

    Code:
    sigxcpu@Library:~$ mount | grep data
    storage/library on /data/library type zfs (rw,noatime,xattr,noacl)
    raid0/torrents on /data/torrents type zfs (rw,noatime,xattr,noacl)
    
    In the config file:

    Code:
    root@gen8:~# grep data /etc/pve/lxc/100.conf
    mp0: /storage/library,mp=/data/library
    mp1: /raid0/torrents,mp=/data/torrents
    
    I think you've reversed host folder and mountpoint in container .conf file.
     
  7. wbumiller

    wbumiller Proxmox Staff Member
    Staff Member

    Joined:
    Jun 23, 2015
    Messages:
    643
    Likes Received:
    82
    Also note that if you use lxc.mount.entry instead of mp* you need to prefix the destination folder with /var/lib/lxc/$VMID/rootfs (obviously replace $VMID with the container's ID)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. RobFantini

    RobFantini Active Member
    Proxmox Subscriber

    Joined:
    May 24, 2012
    Messages:
    1,516
    Likes Received:
    21
    multiple shared directories from host to lxc work here..
    conf:
    Code:
    lxc.mount.entry: /bkup  bkup  none bind 0 0
    lxc.mount.entry: /tmp   tmp2  none bind 0 0
    
    df -h in ct:
    Code:
    /dev/dm-0     ext4     95G   11G   79G  13% /bkup
    /dev/dm-0     ext4     95G   11G   79G  13% /tmp2
    
    it is strange that device is same for both: /dev/dm-0

    however the target directories are correct. the files in each are same as /tmp and /bkup on host



    using:
    proxmox-ve: 4.0-10 (running kernel: 4.2.0-1-pve)
    lxc-pve: 1.1.3-1

    debian etch is run in the lxc .
     
    #8 RobFantini, Sep 15, 2015
    Last edited: Sep 16, 2015
  9. macroonline

    macroonline New Member

    Joined:
    Sep 15, 2015
    Messages:
    2
    Likes Received:
    0
    Oh, really, I'm looking stupid :)


    I've checked with df -h, and it shows only one shared mount.
    But when I tried "mount | grep dm-0", I seen all my mounts.
    Thanks!
     
  10. gurgle

    gurgle New Member

    Joined:
    Sep 2, 2015
    Messages:
    2
    Likes Received:
    0
    Hoping someone can help me out. I had mount points successfully configured but it seems a recent update has broken something. My previous lxc.mount.entry line looked like:

    Code:
    lxc.mount.entry = /host/mount /etc/pve/lxc/209/rootfs/container/mount none bind 0
    (/host/mount and /container/mount are the directory locations, such as /mnt/storage) but this fails to mount now. Upon doing some research i've updated it so that it now looks like

    Code:
    lxc.mount.entry = /host/mount container/mount none bind 0 0
    but i'm still not getting it to mount. Even though the directory already exists, i tried it with the create=dir flag but still nothing.

    On boot there are a number of error messages that seem to relate to LXC mounting

    Code:
    proxmox kernel: audit: type=1400 audit(1443359239.649:32): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-container-default" name="/" pid=10423 comm="mount" flags="rw, remount"
    proxmox kernel: audit: type=1400 audit(1443359239.649:33): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-container-default" name="/" pid=10424 comm="mount" flags="rw, remount, relatime"
    proxmox kernel: audit: type=1400 audit(1443359239.769:34): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-container-default" name="/run/" pid=10645 comm="mount" flags="rw, nosuid, noexec, remount, relatime"
    proxmox kernel: audit: type=1400 audit(1443359239.777:35): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-container-default" name="/run/lock/" pid=10662 comm="mount" flags="rw, nosuid, nodev, noexec, remount, relatime"
    proxmox kernel: audit: type=1400 audit(1443359239.785:36): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-container-default" name="/proc/" pid=10672 comm="mount" flags="rw, nosuid, nodev, noexec, remount, relatime"
    proxmox kernel: audit: type=1400 audit(1443359239.789:37): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-container-default" name="/sys/" pid=10683 comm="mount" flags="ro, nosuid, nodev, noexec, remount, relatime"
    proxmox kernel: audit: type=1400 audit(1443359239.861:38): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-container-default" name="/run/shm/" pid=10847 comm="mount" flags="rw, nosuid, nodev, noexec, remount, relatime"
    proxmox kernel: audit: type=1400 audit(1443359239.869:39): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-container-default" name="/dev/pts/" pid=10858 comm="mount" flags="rw, nosuid, noexec, remount, relatime"
    
    One suggestion i found while googling (cannot post link) involved adding

    Code:
    mount options=(rw, bind),
    to /etc/apparmor.d/lxc/lxc-default. It didn't seem to fix anything.

    Does anyone have any suggestions?
     
  11. wbumiller

    wbumiller Proxmox Staff Member
    Staff Member

    Joined:
    Jun 23, 2015
    Messages:
    643
    Likes Received:
    82
    Yes we moved to a more standard way of mounting the rootfs, replace /etc/pve/lxc/209/rootfs/ with /var/lib/lxc/209/rootfs/.
    Alternatively there's now also a mountpoint option: mp0: /host/mount,mp=/container/mount
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. gurgle

    gurgle New Member

    Joined:
    Sep 2, 2015
    Messages:
    2
    Likes Received:
    0
    Worked it out. Saw this in the 4.0 beta2 release thread:

    I was editing hte config file, not the .conf. All sorted now.
     
  13. tymanthius

    tymanthius New Member

    Joined:
    Nov 22, 2015
    Messages:
    21
    Likes Received:
    0
    Is there any preference to which should be used?

    I'm seeing my mount points drop for no reason I can discern.
     
  14. dietmar

    dietmar Proxmox Staff Member
    Staff Member

    Joined:
    Apr 28, 2005
    Messages:
    16,458
    Likes Received:
    310
    Yes, please use the mountpoint option ( 'mp0')
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. tymanthius

    tymanthius New Member

    Joined:
    Nov 22, 2015
    Messages:
    21
    Likes Received:
    0
    Thank you!

    That seems to be much more stable. :)
     
  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