El MehdiJOUAN EJUpStream
ENFR Contact

NewsInfra

Infra2026-12-043 min read

/etc/fstab without surprises at reboot

Mount by UUID, mark nofail what may be missing, and test with findmnt --verify then mount -a before rebooting.

El Mehdi Jouan

El Mehdi Jouan · Senior System Administrator & Support Engineer · On-Prem & Cloud

· 3 min read

A wrong line in /etc/fstab does not show right away. The system runs, nothing breaks, and it is at the next reboot, sometimes months later, that the machine stops in emergency mode waiting for a disk that no longer exists. On a remote server with no console, that means a trip on site. Three habits avoid it: mount by UUID, mark nofail what is not essential, and test before rebooting.

The tests were done in Debian 12 (util-linux 2.38) and Ubuntu 26.04 (util-linux 2.41) containers, on a 64 MB test disk created for the purpose. The commands are the same on RHEL and Oracle Linux.

1. Mount by UUID, not by disk name

Names like /dev/sdb, /dev/sdc depend on the order in which the kernel finds the disks. Add a disk, change the controller, and /dev/sdb becomes /dev/sdc. The UUID is written in the file system and does not change.

sudo blkid /dev/sdb1

On my test disk, attached as /dev/loop1:

/dev/loop1: LABEL="DONNEES" UUID="d85f0b3d-cbe6-46e5-9a7a-4674dc69d0b4" BLOCK_SIZE="1024" TYPE="ext4"

The matching line in /etc/fstab:

UUID=d85f0b3d-cbe6-46e5-9a7a-4674dc69d0b4  /srv/donnees  ext4  defaults,noatime  0  2

lsblk -f gives the UUIDs of every disk at once.

2. Test the file before rebooting

sudo findmnt --verify

I added three lines on purpose: a correct one, one with a UUID that does not exist, one with a wrong disk, mount point and type. Here is the answer:

/srv/absent
   [E] unreachable on boot required source: UUID=0000-1111-2222
/srv/faute
   [E] unreachable on boot required target: No such file or directory
   [W] unreachable source: /dev/sdz9: No such file or directory
   [W] ext5 seems unsupported by the current kernel
   [W] cannot detect on-disk filesystem type (No such file or directory)

0 parse errors, 2 errors, 3 warnings

Each error is named: the source that cannot be found, the missing mount directory, the unknown file system type. The correct line does not appear. The exit code is 1 as soon as there is an error: it can be used in a deployment script.

3. Then actually mount

findmnt --verify reads the file. mount -a puts it into practice: it mounts everything that is not mounted yet.

$ sudo mount -a ; echo $?
mount: /srv/absent: can't find UUID=0000-1111-2222.
mount: /srv/faute: mount point does not exist.
64

The correct line was mounted:

findmnt /srv/donnees
TARGET       SOURCE     FSTYPE OPTIONS
/srv/donnees /dev/loop1 ext4   rw,noatime

I always do both: findmnt --verify for writing errors, mount -a for the proof. If mount -a fails, the boot will fail too. At boot, systemd waits for a disk declared essential (90 seconds by default), then switches to emergency mode.

4. nofail for what is not essential

A USB backup disk, a network share, a volume plugged in now and then: their absence must not stop the server from booting.

UUID=0000-1111-2222  /srv/absent  ext4  defaults,nofail  0  2

With nofail, mount -a returned 0 in my test: the missing disk is skipped without error, the rest is mounted. At boot, systemd no longer blocks on that disk.

One detail worth knowing: findmnt --verify still reports the line as an error (unreachable on boot required source) even with nofail, on both versions tested. It is not a problem, but it is worth knowing so as not to look for a mistake that is not there.

For a network share, add _netdev: systemd waits for the network to be up before mounting it.

5. One precaution before any change

sudo cp -a /etc/fstab /etc/fstab.$(date +%F)

If the machine still stops in emergency mode, the root password (or the provider's console) gives a shell. Remount the root file system read-write, restore the copy, and reboot:

mount -o remount,rw /
cp -a /etc/fstab.YYYY-MM-DD /etc/fstab
systemctl reboot

The procedure, in short

sudo cp -a /etc/fstab /etc/fstab.$(date +%F)
lsblk -f
sudo findmnt --verify
sudo mount -a ; echo $?
findmnt /mount/point

UUID for stability, nofail for what may be missing, findmnt --verify then mount -a before every reboot.

  • fstab
  • uuid
  • nofail
  • findmnt
  • mount