21

From my understanding of /etc/systemd options, noauto means that the device will not be mounted at boot time (or with mount -a).

Is there any situation where adding nofail changes the behaviour if noauto is already given, or is it totally redundant?

man systemd.mount(5) says:

With noauto, this mount will not be added as a dependency for local-fs.target or remote-fs.target. This means that it will not be mounted automatically during boot, unless it is pulled in by some other unit.

With nofail, this mount will be only wanted, not required, by local-fs.target or remote-fs.target. This means that the boot will continue even if this mount point is not mounted successfully.

What about automount situations?

2 Answers 2

22

Just for the record:

For an external USB disk which is usually not connected at startup, I have an fstab entry

/dev/disk/by-label/data /data   xfs noauto,user,noatime 0   0

When booting there is no error as noautokeeps the system from trying to mount. When I try to mount manually without the drive connected, I immediately get the error

~$ mount /data
mount: special device /dev/disk/by-label/data does not exist
~$ 

If I change the line in fstab to

/dev/disk/by-label/data /data   xfs noauto,nofail,user,noatime  0   0

there is no error reported, even when the drive is not available:

~$ mount /data
~$ 

System: Ubuntu 16.04 with systemd.

6

noauto will still return an error (stderr) during boot if the source is not available.

nofail will remove the errorcheck.

nofail without a x-systemd.device-timeout= specified will default to a 90 second timeout though when the source is not available and you or a process attempt to mount it manually.

Note:x-systemd.device-timeout=0 sets infinite timeout.

Edit: Citation

nofail Do not report errors for this device if it does not exist.

http://man7.org/linux/man-pages/man8/mount.8.html

5
  • 3
    That's not correct. If 'noauto' is set, the mount -a issued at startup will not try to mount and therefore there will be no waiting for the device. If you specify noauto, and try to mount the drive later on manually, you will get an error if it is not available. With nofail there will be no error message, even when the device is not available. What do you mean with 'automount situations'?
    – ridgy
    Commented Feb 23, 2017 at 10:58
  • Since you ask here: I could see that one way the line would get "executed without mount -a, is with autofs and cd /mnt/autofs-directory. I'm wondering if nofail has any effect in that case.
    – Tom Hale
    Commented Feb 23, 2017 at 13:48
  • @m_krsic Welcome to SE.unix. It's good practice to provide evidence (links) for your assertions on SE sites. I've been shocked at how many times I self-corrected in posting what I thought was the case when I got chapter-and-verse in providing a reference.
    – Tom Hale
    Commented Feb 23, 2017 at 13:53
  • @ridgy What isn't correct? If noauto is is set mount -a issued at startup will not try to mount it, but a check is performed to see if the source is there.
    – m_krsic
    Commented Feb 23, 2017 at 15:14
  • 1
    @m_krsic Have you tried this personally, or do you have a reference? Why would it bother checking something that it's not going to mount anyway?
    – Tom Hale
    Commented Feb 24, 2017 at 10:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .