Linux Storage

/etc/fstab explained

Practical Linux guide: /etc/fstab explained without the usual guesswork.

10 min read Beginner Updated 9 Jun 2026

Step-by-step guide

Work through each section in order. Stop when your issue is resolved — you do not need every step for every situation.

Warning

Filesystem and fstab errors can prevent boot or cause data loss. Always run findmnt --verify and keep a rescue environment available.

What you will achieve

Read and write /etc/fstab entries correctly — UUIDs, mount options, dump/pass fields, and systemd mount units generated underneath.

1) fstab columns

# <device>  <mount>  <type>  <options>  <dump>  <pass>
UUID=abc-123  /data  ext4  defaults,noatime  0  2
  • pass0 = skip fsck; 1 = root first; 2 = other filesystems.
  • Use UUID= or PARTUUID=, not /dev/sdX.

2) Get UUID

sudo blkid
lsblk -f

3) Validate before reboot

sudo findmnt --verify
sudo mount -a

4) nofail for optional mounts

UUID=xyz  /mnt/backup  ext4  defaults,nofail,x-systemd.device-timeout=5  0  2

Prevents boot hang if external disk is unplugged.

Verify

systemctl status mnt-backup.mount
findmnt /data

5) systemd mount unit names

/mnt/backup becomes mnt-backup.mount. Debug with:

systemctl status mnt-backup.mount
journalctl -u mnt-backup.mount

6) NFS fstab entry

192.168.1.10:/export /mnt/nfs nfs4 defaults,_netdev,nofail 0 0

_netdev waits for network — critical for boot order.

7) btrfs subvolumes

UUID=xxx / @,subvol=@  btrfs  defaults,noatime,compress=zstd  0  0

Common mistakes

  • Typos in UUID — boot drops to emergency shell.
  • Missing nofail on removable media — hang at boot.
  • Wrong filesystem type — mount fails, fsck may be needed.

8) x-systemd.requires for network mounts

x-systemd.requires=network-online.target

Prerequisites

blkid output for UUIDs. Understanding mount point directories exist (mkdir -p). Test with mount -a before reboot. Recovery media if fstab breaks boot.

UUID vs LABEL

LABEL=data_disk human-readable but labels can duplicate; UUID is unique per filesystem — prefer UUID in production fstab.

noauto manual mounts

UUID=x /mnt/archive ext4 noauto,user 0 0

Desktop users mount on demand without boot hang — user allows non-root mount.

systemd automount

x-systemd.automount

Delays mount until first access — useful for slow NFS or optional archives — reduces boot time vs blocking mount in fstab at boot.

errors=remount-ro

ext4 fstab option remounts ro on error — explains sudden read-only without obvious full disk — dmesg shows I/O error preceding ro remount.

test with findmnt after cloud-init

Cloud images inject fstab via cloud-init — manual edits may be overwritten on next boot — persist changes in cloud-init config or post-boot automation.

comment field documentation

Add fourth field comment in team wiki not fstab — but prepend # line above fstab entry explaining who added mount and ticket number for future admin scratching head over mystery NFS path.

Related guides

explained fstab linux