Carlos Lopez
2021-Apr-21 07:36 UTC
[CentOS] Problem with RequiresMountsFor defined in a systemd service
Hi all, I have setup a systemd service that needs to mount a NFS share before starts. To accomplish this I have defined: RequiresMountsFor=/data/sysos As a dependency in [Unit] section but it doesn?t work. NFS share is defined in fstab with ?defaults,noauto? options also .. What am I doing wrong? How can I debug this? Best regards, C. L. Martinez
Kris Knigga (TT)
2021-Apr-21 13:15 UTC
[CentOS] Problem with RequiresMountsFor defined in a systemd service
On Wed, Apr 21, 2021 at 2:37 AM Carlos Lopez <clopmz at outlook.com> wrote:> Hi all, > > I have setup a systemd service that needs to mount a NFS share before > starts. To accomplish this I have defined: > > RequiresMountsFor=/data/sysos > > As a dependency in [Unit] section but it doesn?t work. NFS share is > defined in fstab with ?defaults,noauto? options also .. > >Maybe set up the NFS mount with autofs instead?
Jonathan Billings
2021-Apr-21 13:23 UTC
[CentOS] Problem with RequiresMountsFor defined in a systemd service
On Wed, Apr 21, 2021 at 07:36:26AM +0000, Carlos Lopez wrote:> > Hi all, > > I have setup a systemd service that needs to mount a NFS share before starts. To accomplish this I have defined: > > RequiresMountsFor=/data/sysos > > As a dependency in [Unit] section but it doesn?t work. NFS share is defined in fstab with ?defaults,noauto? options also .. > > What am I doing wrong? How can I debug this?Having 'noauto' in the fstab options means that it can only be mounted explicitly, and not through automatic mounting (which is what systemd would do if you set it up as an automount). You need to either fix it so it gets mounted on demand, or use some other method to start it. -- Jonathan Billings <billings at negate.org>