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
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-reloadSteps
- Without rebooting, find the mount unit systemd generated for /srv/ghost and see what happens when it starts.
- Change the entry so the boot continues without the disk and gives up waiting after 10 seconds.
- Validate fstab, reboot and measure the result.
- Restore the original fstab.
Verification
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-runningShow the solution
The generated unit is srv-ghost.mount. Starting it waits for the device job and fails:
systemctl cat srv-ghost.mount
sudo systemctl start srv-ghost.mount # waits 90 s, then "Dependency failed"Fix the line, then validate:
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 --verboseAfter the reboot, systemctl is-system-running can say "degraded" because the mount still failed, but the machine is up. Restore the file:
sudo cp /etc/fstab.lab-backup /etc/fstab && sudo systemctl daemon-reload