Linux Labs EspañolES

Hardware and boot Labs

Make a missing data disk harmless at boot

Practitioner25 minYour VMRHEL and Debian families

Objective

An fstab entry for a disk that is not present neither blocks the boot nor delays it more than 10 seconds.

Requirements

  • A disposable VM with console access and a snapshot. A wrong fstab can stop the boot.

Setup

bash
sudo mkdir -p /srv/ghost
sudo cp /etc/fstab /etc/fstab.lab-backup
echo 'UUID=00000000-0000-4000-8000-000000000000 /srv/ghost xfs defaults 0 0' | sudo tee -a /etc/fstab
sudo systemctl daemon-reload

Steps

  1. Without rebooting, find the mount unit systemd generated for /srv/ghost and see what happens when it starts.
  2. Change the entry so the boot continues without the disk and gives up waiting after 10 seconds.
  3. Validate fstab, reboot and measure the result.
  4. Restore the original fstab.

Verification

bash
findmnt --verify --verbose
systemctl status srv-ghost.mount --no-pager | head -n 5
systemd-analyze critical-chain srv-ghost.mount 2>/dev/null | head -n 5
systemctl is-system-running
Show the solution

The generated unit is srv-ghost.mount. Starting it waits for the device job and fails:

bash
systemctl cat srv-ghost.mount
sudo systemctl start srv-ghost.mount   # waits 90 s, then "Dependency failed"

Fix the line, then validate:

bash
sudo sed -i 's#^UUID=00000000-0000-4000-8000-000000000000 /srv/ghost xfs defaults#UUID=00000000-0000-4000-8000-000000000000 /srv/ghost xfs defaults,nofail,x-systemd.device-timeout=10s#' /etc/fstab
sudo systemctl daemon-reload
findmnt --verify --verbose

After the reboot, systemctl is-system-running can say "degraded" because the mount still failed, but the machine is up. Restore the file:

bash
sudo cp /etc/fstab.lab-backup /etc/fstab && sudo systemctl daemon-reload