A partition mounted with mount is gone after a reboot. Here is how to put it in fstab so that a missing disk does not stop the boot.
The partition's line goes into /etc/fstab with the same six fields as in the mounting lesson. The source is UUID= from blkid: a name like /dev/loop0p1 or /dev/vdb1 depends on the order in which disks are attached.
The nofail option is for data disks. Without it every line of the table is required for boot: the system waits a minute and a half for the device and, if it never shows up, stops in emergency mode, and someone has to get to the console. With nofail the system boots without the disk. The root / is never marked this way: without it the system has nothing to run from.
Checking does not need a reboot:
Without daemon-reload, systemd keeps the old table in mind, and findmnt --verify warns: your fstab has been modified, but systemd still uses the old version. If the partition is back in the directory after mount -a, the entry is correct.
The data disk was removed from the server, but its /etc/fstab line with the options defaults stayed. What happens at the next boot?
-
The root is mounted at
/, and the/srv/dataline has nothing to do with it. The source from the line will not be found, and the mount fails. -
People edit the table: systemd reads it at boot and changes nothing in it.
-
That is how a system with a
nofailline boots. Without the option the disk is required: the system waits for it and drops into emergency mode.
Without nofail every fstab line is required for boot. When the device never shows up, the system stops in emergency mode and waits for someone at the console; with nofail it boots without the disk.
Key points
- A partition goes into fstab by its filesystem UUID: after a reboot the device name may belong to another disk.
-
nofaillets the system boot without a data disk; without the option a missing disk stops the boot. -
You check the entry without a reboot:
daemon-reload, thenumountandmount -a.