fstab

Mount configuration, critical options (nofail, _netdev), NFS gotchas, and emergency mode recovery. Battle-tested during INC-2026-04-13-001.

Reading fstab

Show all entries with line numbers — essential before editing
awk '{print NR": "$0}' /etc/fstab
Show only active (uncommented) entries
grep -v '^#' /etc/fstab | grep -v '^$'
Find specific mount entries — pattern match across all fields
awk '/volume1|sdb1/' /etc/fstab
awk '/nfs|nas|10.50.1.70/' /etc/fstab

fstab Fields

Field layout — 6 columns, whitespace-separated
<device>  <mountpoint>  <type>  <options>  <dump>  <pass>
Field Purpose

device

Block device (/dev/sdb1), UUID (UUID=xxx), NFS (10.50.1.70:/path), or LABEL

mountpoint

Where to mount (/mnt/nas/vms)

type

Filesystem — ext4, xfs, nfs, swap, auto

options

Comma-separated mount options

dump

Backup flag (0 = skip, 1 = dump) — almost always 0

pass

fsck order (0 = skip, 1 = root, 2 = other) — 0 for NFS

Critical Options

nofail — prevents emergency mode when mount fails
# WITHOUT nofail: mount failure → emergency mode → system unusable
/dev/sdb1 /mnt/data ext4 defaults 0 0

# WITH nofail: mount failure → warning in journal, boot continues normally
/dev/sdb1 /mnt/data ext4 defaults,nofail 0 0
Every non-root mount MUST have nofail. Without it, a single disk failure or network storage outage turns a storage problem into a compute outage. This is the #1 cause of unexpected emergency mode.
_netdev — wait for network before mounting (required for NFS/CIFS)
10.50.1.70:/volume1/vms /mnt/nas/vms nfs defaults,_netdev,nofail 0 0
x-systemd.device-timeout — limit how long systemd waits for mount
# Wait max 10 seconds for NFS, then give up (with nofail, boot continues)
10.50.1.70:/volume1/vms /mnt/nas/vms nfs defaults,_netdev,nofail,x-systemd.device-timeout=10 0 0
x-systemd.automount — mount on first access, not at boot
# Lazy mount — only mounts when something reads /mnt/nas/vms
10.50.1.70:/volume1/vms /mnt/nas/vms nfs defaults,_netdev,nofail,x-systemd.automount 0 0

Gotchas

Filesystem Type Mismatch — Silent Boot Killer

blkid reveals the truth — don’t trust fstab, verify
blkid /dev/sdb1
# /dev/sdb1: LABEL="DEV-STORAGE" UUID="..." TYPE="ext4"

If fstab says xfs but the partition is ext4, you get invalid superblock and emergency mode. Always verify with blkid before writing fstab entries.

# WRONG — fstab says xfs, disk is ext4 → emergency mode
/dev/sdb1 /mnt/onboard-ssd xfs defaults 0 0

# CORRECT — match the actual filesystem
/dev/sdb1 /mnt/onboard-ssd ext4 defaults,nofail 0 0

NFS Hostname DNS Circular Dependency

Never use hostnames for NFS mounts — always use IPs
# WRONG — hostname needs DNS, DNS runs on a VM, VM images are on NFS
# Boot deadlock: NFS needs DNS → DNS needs VM → VM needs NFS
nas-01:/volume1/vms /mnt/nas/vms nfs defaults,_netdev 0 0

# CORRECT — IP doesn't need DNS resolution
10.50.1.70:/volume1/vms /mnt/nas/vms nfs defaults,_netdev,nofail,x-systemd.device-timeout=10 0 0
What it looks like when hostname resolution fails
$ sudo mount -a
mount.nfs: Failed to resolve server nas-01: Name or service not known
mount.nfs: Failed to resolve server nas-01: Name or service not known
mount.nfs: Failed to resolve server nas-01: Name or service not known

Editing fstab with sed

Replace an entire line matching a pattern — sed c\ command
# Replace NFS entry — pattern matches, c\ replaces entire line
sudo sed -i '/volume1\/vms/c\10.50.1.70:/volume1/vms /mnt/nas/vms nfs defaults,_netdev,nofail,x-systemd.device-timeout=10 0 0' /etc/fstab
Workaround for long lines that break in terminal copy-paste
# Use sudo bash -c to keep the command on one line
sudo bash -c "sed -i '/volume1\/backups/c\\10.50.1.70:/volume1/backups /mnt/nas/backups nfs defaults,_netdev,nofail,x-systemd.device-timeout=10 0 0' /etc/fstab"
Comment out a line — emergency mode escape hatch
# Comment out all NAS mounts to get past emergency mode
sed -i '/nas-01/s/^/#/' /etc/fstab

# Comment out a specific device
sed -i '/sdb1/s/^/#/' /etc/fstab
Always reload after editing
sudo systemctl daemon-reload

Production-Ready NFS Pattern

Complete NFS fstab entry — every option explained
10.50.1.70:/volume1/vms /mnt/nas/vms nfs defaults,_netdev,nofail,x-systemd.device-timeout=10 0 0
#          │                │           │   │        │       │       │                          │ │
#          │                │           │   │        │       │       └─ 10s timeout             │ │
#          │                │           │   │        │       └─ boot continues if mount fails   │ │
#          │                │           │   │        └─ wait for network                        │ │
#          │                │           │   └─ standard mount defaults                          │ │
#          │                │           └─ NFS filesystem type                                  │ │
#          │                └─ local mount point                                                │ │
#          └─ NFS server IP (never hostname!)                                          dump─┘ pass┘

Emergency Mode Recovery

When fstab drops you to emergency mode
# 1. You're at the emergency prompt. Check what failed:
systemctl --failed

# 2. If filesystem is read-only, remount root as writable:
mount -o remount,rw /

# 3. Comment out the failing mount:
vi /etc/fstab
# Find the line, I then # then Esc, :wq!

# 4. Reload and exit emergency mode:
systemctl daemon-reload
exit

See Also

  • NFS — NFS server/client, the most common fstab foot-gun

  • Disk — block devices, partitions, blkid

  • systemd — daemon-reload, emergency mode targets

  • Boot — boot process, emergency mode troubleshooting