Systemd services start too soon, need to wait for hard disk to mount


#1

I have some systemd service, nfs-server and minidlna, that start before the hard disk of which they share the content is mounted, how can I change that?

Hard disks are auto-mounted by fstab on one computer and setted to automount by gnome-disk-utility on the other


#2

I’m surprised that systemd serv-asses are still so outta-sync with NFS, …, -are devs@systemd still asleep behind the wheel or what ?!


#3

You just need to set a requirement for a specific mountpoint to the system service.t

You can also set a requirement for the nfs-server service to your fstab, via x-systemd.requires= mountoption.

https://www.freedesktop.org/software/systemd/man/systemd.mount.html#

systemd is very flexible in that way. :+1: They just can not know how a user configures its system, so please stop that FUD :wink:


#4

It wasn’t “FUD” based, but I’ll agree that it was insulting, and therefore unwarranted on my part, so I’ll simply “systemctl-sudo-machinectl --leave” this topic for now.
:wink:


#5

Thanks to @Tids for pointing in the right direction, after a few attempts I got it


For every entry in fstab a systemd .mount file is automatically generated, search with

$ systemctl list-unit-files | grep “.mount”

The needed file name is

mnt-WDmedia.mount

Now edit the interested service adding the following under the [unit] section

Requires=mnt-WDmedia.mount
After=mnt-WDmedia.mount

Reboot to see if changes are effective


Bind mounting & NFS
#6

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.