1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[SOLVED] What is the proper way to auto mount Samba share in a container?

Discussion in 'Proxmox VE: Installation and configuration' started by fernback, Nov 14, 2017 at 04:04.

  1. fernback

    fernback New Member

    Joined:
    Tuesday
    Messages:
    5
    Likes Received:
    0
    I have media that needs to be shared between containers. Previously I had everything on drives in my server that Proxmox ran on, so I set up a NFS server directly in Proxmox then did bind mounts for the containers. I just moved all my media storage over to a Synology unit so now I am trying to figure out the best way of sharing and it seems like Samba is the way to go.

    Whats the proper way to auto mount a Samba share inside a container? I've tried a bunch of different things but I'm coming up blank.

    Right now I have added the mount into the fstab of the containers but it doesn't actually mount. If I run 'mount -a' inside the container after boot then the share does mount properly but it won't automatically do it.

    I don't think fstab is the way I'm supposed to do it, I just haven't been able to find the answer I'm looking for so I've just been experimenting.

    *edit*

    Got the problem fixed. I am using Arch Linux for the containers that need to access this share and it turned out to be an Arch thing, not a Proxmox problem. In case anybody comes across in search, if you want to mount a Samba share through fstab in Arch and it doesn't mount, enable the systemd service systemd-networkd-wait-online
     
    #1 fernback, Nov 14, 2017 at 04:04
    Last edited: Nov 14, 2017 at 19:14
  2. Alexander Pytlev

    Joined:
    Apr 14, 2016
    Messages:
    35
    Likes Received:
    6
    Add '_netdev' to mount options in fstab, like this:

    //qnap/share /data cifs username=qnap,password=<your_pass>,_netdev,uid=1000,gid=1000 0 0
     
  3. fernback

    fernback New Member

    Joined:
    Tuesday
    Messages:
    5
    Likes Received:
    0
    That seemed to make things freeze up. I edited fstab and rebooted, but this made the container become unresponsive. It wouldn't boot back up, Proxmox showed it as off but with a spinning circle for a few minutes without an update.

    I connected to Proxmox through ssh and this was the message

    Message from syslogd@proxmox at Nov 13 23:49:43 ...
    kernel:[369460.512246] unregister_netdevice: waiting for lo to become free. Usage count = 1

    After booting the container from terminal the drive wasn't mounted.
     
  4. Alexander Pytlev

    Joined:
    Apr 14, 2016
    Messages:
    35
    Likes Received:
    6
    You don't describe, what OS in CT used.

    For test, I created Proxmox CT from debian 9 template, instal cifs-utils inside CT and try mount smb share from another linux box.

    fstab:
    //linux-box/share /mnt/share cifs _netdev,username=xxx,password=yyy,iocharset=utf8 0 0

    In my situation it work both, with _netdev and without.
     
  5. fernback

    fernback New Member

    Joined:
    Tuesday
    Messages:
    5
    Likes Received:
    0
    Sorry, I thought that fstab was universal between distros. I am using Arch Linux but I could change over to Debian or Cent pretty easily if needed. I'll do a test on Debian this afternoon to see if that works or not.
     
  6. fernback

    fernback New Member

    Joined:
    Tuesday
    Messages:
    5
    Likes Received:
    0
    I just spun up a Debian 9 container, installed cifs-utils, put the exact same entry from my Arch fstab in and it works. So this must be an Arch issue instead of a Proxmox one. I'll need to do some digging.
     
  7. fernback

    fernback New Member

    Joined:
    Tuesday
    Messages:
    5
    Likes Received:
    0
    Alright, got this fixed. It was a distro specific issue, not a Proxmox problem like I thought. I had to enable systemd-networkd-wait-online.service and now it works as expected.
     

Share This Page