Mount SMB share to host?

Dunuin

Distinguished Member
Jun 30, 2020
14,793
4,630
258
Germany
Hi,

Some of my unprivileged LXCs are using data from SMB shares. Because mounting SMB shares inside the LXC isn't possible, I mounted the SMB shares directly to the host (fstab entry) and bind-mounted that mountpoint into my LXC. I changed the user/group remapping and everything works fine...except that I always need to run mount -a first or the shares woundn't be mounted and without the mounted shares the LXCs can't be started.

What is the right way to auto mount a SMB share to the host at boot?

Like I said editing /etc/fstab doesn't work as I thought. Works fine with VMs (no need to manually run mount -a there) but not on the proxmox host itself.
I also thought about adding a CIFS-Storage using the proxmox GUI but I need to set the UID and GID and the GUI isn't offering options to set that.

This is my fstab entry:
Code:
# <file system>                                 <mount point>                   <type>  <options>                                                                               <dump>  <pass>
//192.168.45.1/Ebooks                           /media/Ebooks                   cifs    auto,rw,credentials=/root/.smb_ebooks,uid=1102,gid=1102,file_mode=0660,dir_mode=0770    0       0

I also encountered problems with CIFS storages (managed by the proxmox GUI) going into "unknown" state if the connection to the NAS is lost. I looked at the logs of my monitoring tool and the NAS was only offline for some minutes but proxmox didn't remount the shares half a day later. So it looks like my proxmox isn't trying to remount a SMB share until I reboot the complete server.

Is there some kind of deamon that I can use to auto mount SMB shares and that will monitor the share and remounts it automatically if a share is available again?

How are you handling SMB shares?
 
Last edited:
My storage is also mounted on the host.
I share it from the host with smb and for the LXC's I add the mount point from the GUI or from the terminal:
Code:
root@pve:~# pct set LXC_Number -mp0 /host_mountPoint,mp=/LXC_folder
 
My storage is also mounted on the host.
I share it from the host with smb and for the LXC's I add the mount point from the GUI or from the terminal:
Code:
root@pve:~# pct set LXC_Number -mp0 /host_mountPoint,mp=/LXC_folder
Yes, that is already working fine. Bind-mounting folders from host to LXC works. That problem is that SMB shares are not automatically mounted on the proxmox host.
 

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!