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

fernback

New Member
Nov 14, 2017
9
1
3
34
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
 
Last edited:
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
 
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
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.
 
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.
 
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.
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.
 
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.
 
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.
 
How do you add that line to the fstab file? Where is the fstab file located on the client (Ubuntu 16.04 CT)?
 
i tired but none of them are working

1. fstab with
a. _netdev
b. x-systemd.automount
c. No options
d. both options

2. crontab

3. Mounting script @startup

4. folder binding (adding this in config file)
mp0: /media/share, mp=/mnt/nfs

host : Proxmox 5.2-10
CT : debian9/ubuntu 16.04, ubuntu 18.04

Solution : using this command in proxmox as root solved problem

pct set 100 -mp1 /media/share,mp=/media/share
 
Last edited:
  • Like
Reactions: majorgear

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!