0

I am tasked with managing a complex structure of Linux (CentOS 8) VMs and hardware, hosting among other things various SMB and NFS exports. Most of them are simultaneously servers and clients, of one protocol or both.

Ideally of course I'd want all filesystems to be included in /etc/fstab on each machine, so everything comes up automatically. The catch is I do not have any physical access to the hardware or console access to the VMs, only SSH access to everything. And, to the best of my understanding, under the default options, if one of the mounts is unavailable at boot the system will hang indefinitely. Therefore if, say, two of the machines go down but only one comes up, and some of the mounts become inaccessible (or if I just make a mistake in one of the fstabs) everything might end up unbootable with no straightforward way of fixing it.

What's the best way to set this up? A soft mount would be one option, but my reading suggests it risks silent data corruption, which I absolutely cannot risk given the nature of the workload. I've considered nofail, but I'm getting a bit confused by the definition from the man page:

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

Clearly I do want some kind of error to be reported, but I do want the machine to boot so I can fix it.

Any ideas? Thanks very much in advance.

2 Answers2

0

Mounting filesystems from /etc/fstab on CentOS 8 is handled by systemd, the documentation for which goes into much more detail about the things you need to know. For example, about nofail:

With nofail, this mount will be only wanted, not required, by local-fs.target or remote-fs.target. Moreover the mount unit is not ordered before these target units. This means that the boot will continue without waiting for the mount unit and regardless whether the mount point can be mounted successfully.

You should also notice that systemd allows for setting an explicit timeout, with x-systemd.mount-timeout=, which you should consider doing if there is a possibility that a remote server might be down.

Configure how long systemd should wait for the mount command to finish before giving up on an entry from /etc/fstab. Specify a time in seconds or explicitly append a unit such as "s", "min", "h", "ms".

Note that this option can only be used in /etc/fstab, and will be ignored when part of the Options= setting in a unit file.

See TimeoutSec= below for details.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
0

Depending on the complexity and circumstances, you might need to write your own systemd units and/or start scripts and/or monitoring scripts or even use something like Linux-HA.

On some not too complex systems with some simple fail-over solutions I have a shell script which checks the devices and network (VPN) connections, starts the VMs and sends a start report. A separate monitoring system generates alerts...

Zrin
  • 597
  • 1
  • 5
  • 14