Start LXC container even if mount fails on Host (mp)

gigagames

Member
May 14, 2021
6
1
23
29
Hi,

I have some SMB shares mounted on my Proxmox host that are propagated to unprivileged LXC containers.
The entry in my /etc/fstab is as follows:
//Server/Paperless /mnt/paperless/ cifs credentials=/root/.truenas-smb-paperless.conf,file_mode=0770,dir_mode=0770,gid=100113,_netdev,soft,x-systemd.automount 0 0
In my LXC container config, I've added the following line:
mp1: /mnt/paperless/media,mp=/opt/paperless/media
This setup works as expected, but if the SMB mount fails for any reason (e.g., if Proxmox boots faster than the NAS), the container startup fails because the mount point folder on the host doesn’t exist. If I manually create the folder on the host, the container starts without issue, even if the mount has failed. However, once the mount succeeds, the data isn't propagated to the container, so the folder inside the LXC remains empty.

Is there a more efficient way to handle this? Ideally, I’d like the LXC container to always start, and then automatically have the server data available as soon as the mount is ready.
 
This could be done by mounting the /mnt/paperless directory into the container.
mp1: /mnt/paperless,mp=/opt/paperless