systemd automount does not work when the mount point doesn't exist from Red Hat Enterprise Linux 7.5

Solution Unverified - Updated -

Issue

  • I have a line in /etc/fstab:
tmpfs /mnt/test tmpfs defaults,noauto,x-systemd.automount 0 0
  • /mnt/test directory doesn't exist. It's expected that it's created automatically by systemd.
  • From man systemd.automount:
DirectoryMode=
      Directories of automount points (and any parent directories) are automatically created if needed. This option specifies the
      file system access mode used when creating these directories. Takes an access mode in octal notation. Defaults to 0755.
  • This manpage indicates that the mount point should be created automatically when it doesn't exist, regardless of the existence of DirectoryMode= option.
  • I had the following error with systemctl start mnt-test.automount
Path /mnt/test is already a mount point, refusing start for mnt-test.automount
  • This worked until Red Hat Enterprise Linux 7.4

Environment

Red Hat Enterprise Linux 7.5 and 7.6

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