3

I am trying to mount an NFS share on a CentOS 7 box using systemd. This is my /etc/fstab entry:

10.0.0.104:/export   /mnt       nfs  users,noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,noatime 0 0

On boot or by entering mount -a has no effect, the partition is not mounted. Nothing seems to be logged either from what I can see.

If I mount it from the CLI with the same options however it works:

mount -t nfs -o users,noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,noatime 10.0.0.104:/export /mnt

Any idea why it might be failing when not calling it using the mount CLI?

2 Answers 2

2

From man mount:

mount -a [-t type] [-O optlist]

(usually given in a bootscript) causes all filesystems mentioned in fstab (of the proper type and/or having or not having the proper options) to be mounted as indicated, except for those whose line contains the noauto keyword.

From systemd.mount documentation:

noauto, auto

With noauto, this mount will not be added as a dependency for local-fs.target. This means that it will not be mounted automatically during boot, unless it is pulled in by some other unit. Option auto has the opposite meaning and is the default.

As you can see, any /etc/fstab line with noauto won't automatically mount when using the mount -a command.

You have noauto in your /etc/fstab. If you were to remove this, then it should work.

1

it should also be noted that, after adding x-systemd.automount to an fstab line, you need to run:

  sudo systemctl daemon-reload

and then one, or both, of the following:

  sudo systemctl restart remote-fs.target
  sudo systemctl restart local-fs.target

only then will the automount will become active and usable.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.