Systemd can use .mount files to make services and stuff depend on the availability of a mount. They can either be created by hand or are created automatically from fstab.
IIRC You simply write/change the fstab as in every system. Then you say “systemctl daemon-reload” once, and this (re)creates your .mount files. Then “mount -a” or whatever you need.
I had something similar when I used to mount an NFS share. I had a bash line that would loop ping and then mount once ping succeeds. Having a separate service that pings and making the mount dependent on it is probably the better thing to do. Should also work when put in Requires= in a .mount file.
can someone please tell me how to make .mount files start at boot for smb shares ffs? is the only thing systemd is failing for me.
My nfs mounts always add 1:45 to my boot even though I added _netdev to their lines in fstab. I don’t get it.
I dont know what you are doing, but I have my smb shares simply in fstab and never heard of any .mount file
On modern systems, fstab entries are read by systemd and .mount files are automatically created for each entry. 😄
i am making them in salt-stack systemd templates/pillars. i will see what i miss when i do a fstab one.
Systemd can use .mount files to make services and stuff depend on the availability of a mount. They can either be created by hand or are created automatically from fstab.
thanks everyone.
IIRC You simply write/change the fstab as in every system. Then you say “systemctl daemon-reload” once, and this (re)creates your .mount files. Then “mount -a” or whatever you need.
https://wiki.archlinux.org/title/Samba#As_systemd_unit
That’s the guide I followed on my desktop and laptop.
thanks,
Can you see if its trying and failing by using journalctl?
no matter what i do it only does on try.
Network not ready by time the mount is executed?
yup,
I have a service that pings the server:
And then I make the fstab entry depend on it:
x-systemd.requires=ping-smb.serviceI had something similar when I used to mount an NFS share. I had a bash line that would loop ping and then mount once ping succeeds. Having a separate service that pings and making the mount dependent on it is probably the better thing to do. Should also work when put in
Requires=in a.mountfile.