How to configure a service in systemd which needs a specific filesystem to be mounted before starting on boot?

Solution Verified - Updated -

Issue

  • An installed service needs a specific filesystem (for example NFS) to be mounted in order to function properly.
  • An attempt to start said service before the filesystem is mounted correctly results into fail. (if this happens during boot, boot time gets delayed and the service is not running after the boot sequence)
  • How to configure the service file so that systemd will always wait for the said mount to start the service?

Environment

  • Red Hat Enterprise Linux (RHEL) 7
  • Red Hat Enterprise Linux (RHEL) 8
  • Red Hat Enterprise Linux (RHEL) 9
  • systemd

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content