3

I am responsible for maintaining a Linux (Ubuntu) machine in my company. We mounted some NFS network drives. In irregular intervals (during holidays), the machine is forcefully restarted because the company turns off all electricity. After re-boot, the NFS network drives are gone and have to be mounted manually again in our current configuration.

I know about /etc/fstab, which contains a list of drives that should be mounted on system startup. I would like to edit this file to auto-mount the network drives on system startup. However, I am wondering what happens at system start if the file contents are invalid (e.g., syntax error) or if the network drives are, for some reason, inaccessible during mount (no network connection, server down, ...).

  1. Is it safe to assume that the machine will boot and be usable without the mounted drives the next time?
  2. If the file contains an error, will all drives not be mounted or only the erroreous ones?
  3. If some network drives cannot be mounted, will at least some drives (i.e., the hard drives/RAID) be mounted?
  4. Are there safer/better/more convenient alternatives to /etc/fstab in this use-case?
1
  • Thanks. If there's an error with systemd mount, the system start is not affected and the error can later be retrieved from the logs? Commented Jan 4, 2022 at 3:30

1 Answer 1

2

Assuming your system is running systemd, and your network file systems are listed in /etc/fstab with the _netdev option:

  1. The machine will boot, even if one or more of the network file systems are unavailable; if it doesn’t need the network file systems, then it will be usable. The boot will take longer however, since the default timeout for network file systems is 90s; you can add the nofail option to avoid this timeout, and make it explicit that the file system isn’t required.

  2. Non-network file systems with errors will need to be dealt with during boot. For network file systems, see above.

  3. Everything that can be mounted will be mounted, unless you configure the system otherwise.

  4. /etc/fstab is still the recommended configuration mechanism for file systems, even with systemd.

I have systems configured in exactly this manner and they boot as described.

2
  • 1
    At least in Debian 11, according to man 5 systemd.mount, the _netdev option only delays the mount attempt to after the network is available. To make the boot process not fail if the filesystem cannot be mounted, you'll always need the nofail mount option, whether the filesystem is network-based or a local one.
    – telcoM
    Commented Jan 4, 2022 at 5:56
  • @telcoM my systems are configured without nofail and work as described in the answer. Commented Jan 4, 2022 at 6:21

You must log in to answer this question.

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