8.2 Persistent Mounts: /etc/fstab, UUIDs & systemd mount units (104.3)

Key Takeaways

  • The `/etc/fstab` (File System Table) configuration file defines static filesystem mounting rules evaluated during system boot and when executing `mount -a`.
  • Each entry in `/etc/fstab` consists of exactly six whitespace-separated fields: Device Identifier, Mount Point, Filesystem Type, Mount Options, Dump Frequency, and Fsck Pass Order.
  • Using persistent identifiers such as `UUID=...` or `LABEL=...` instead of volatile device paths (`/dev/sda1`) prevents boot failures caused by drive reordering during storage controller enumeration.
  • The sixth field (`fsck` pass order) dictates boot-time filesystem integrity checking: `1` is reserved exclusively for the root (`/`) filesystem, `2` is used for other local physical filesystems, and `0` disables checks (mandatory for swap, tmpfs, and modern filesystems like XFS and Btrfs).
  • Systemd automatically parses `/etc/fstab` at boot using `systemd-fstab-generator`, creating native `.mount` and `.automount` units in `/run/systemd/generator/` using escaped path naming (e.g., `/var/log` becomes `var-log.mount`).
Last updated: August 2026

8.2 Persistent Mounts: /etc/fstab, UUIDs & systemd mount units

Quick Summary: Filesystem attachments made manually using the mount command are temporary and do not survive a system reboot. To make mounts persistent, Linux reads the /etc/fstab (File System Table) configuration file during system startup. Every line in /etc/fstab defines a storage device, its designated mount point, its filesystem type, specific mount options, dump backup scheduling, and filesystem integrity check (fsck) order. Modern Linux distributions convert /etc/fstab entries dynamically into native systemd .mount units. Mastering /etc/fstab column structure, persistent identifiers (UUID, LABEL), and verification techniques (mount -a) is a core LPIC-1 competency.


1. Anatomy of the /etc/fstab Configuration File

The /etc/fstab file is plain text. Blank lines and lines beginning with a hash mark (#) are treated as comments and ignored by the parser. Each active entry consists of exactly six whitespace-separated columns (spaces or tabs):

# Sample /etc/fstab entry:
# [1. Device]                                [2. Mount]   [3. Type]  [4. Options]             [5. Dump] [6. Pass]
UUID=4a92c3d1-81f2-4e02-990a-1123456789ab    /            ext4       defaults,noatime         0         1
UUID=9f8e7d6c-5b4a-3210-fedc-ba9876543210    /home        xfs        defaults,nodev,nosuid    0         0
LABEL=BACKUP_DATA                            /mnt/backup  ext4       defaults,noauto,user     0         2
/dev/sr0                                     /media/cdrom iso9660    ro,user,noauto           0         0
/dev/sda3                                    none         swap       sw                       0         0
192.168.1.50:/exports/data                   /mnt/nfs     nfs        _netdev,defaults         0         0

The 6 /etc/fstab Columns Reference Table

ColumnField NamePermitted Values & Common FormatsFunctional Purpose
1Device / File SystemUUID=..., LABEL=..., PARTUUID=..., /dev/sda1, server:/share, tmpfs, proc, noneIdentifies the physical block device, network share, or virtual pseudo-filesystem to be mounted.
2Mount PointAbsolute directory path (e.g., /, /boot, /home, /var), or none / swap for swap spaceSpecifies the target directory in the VFS hierarchy where the filesystem will be attached.
3Filesystem Typeext4, xfs, btrfs, vfat, iso9660, swap, nfs, autoDefines the driver needed to parse the filesystem data structures.
4Mount OptionsComma-separated list with no spaces (e.g., defaults, ro, noexec, nosuid, noatime, nofail, _netdev)Controls operational parameters, permissions, caching, and startup dependencies.
5Dump Frequency0 (do not dump) or 1 (dump backup enabled)Used by the legacy dump backup utility to determine if the filesystem needs backup. Almost universally set to 0 on modern systems.
6Fsck Pass Order0 (no boot check), 1 (checked first; reserved for /), 2 (checked second; other local filesystems)Dictates the order in which fsck scans and repairs filesystems during boot.

2. Field-by-Field Technical Breakdown

Field 1: Device Identifiers (UUID vs. LABEL vs. Device Nodes)

Using traditional device paths like /dev/sda1 in /etc/fstab is dangerous in modern systems. When storage hardware changes, controllers reinitialize, or USB drives are inserted, kernel device enumeration order can shift, causing /dev/sda1 to become /dev/sdb1 and leading to boot failure.

To prevent this, Linux supports persistent device naming:

  1. UUID= (Universally Unique Identifier): A 128-bit hex string stored in the filesystem superblock (e.g., UUID=4a92c3d1-81f2-4e02-990a-1123456789ab). It remains constant even if the drive is moved to another SATA/NVMe port.
  2. LABEL=: A human-readable volume label assigned during filesystem creation or via tools like e2label or xfs_admin -L (e.g., LABEL=ROOT_OS or LABEL=BACKUP).
  3. PARTUUID= / PARTLABEL=: Identifiers stored in the GPT partition table rather than the filesystem superblock.
# Inspect UUIDs and Filesystem Types using blkid:
$ sudo blkid
/dev/sda1: UUID="4a92c3d1-81f2-4e02-990a-1123456789ab" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="000a12bc-01"
/dev/sda2: UUID="9f8e7d6c-5b4a-3210-fedc-ba9876543210" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="000a12bc-02"

# Inspect block devices, UUIDs, and mount points using lsblk:
$ lsblk -f
NAME   FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                            
├─sda1 ext4   1.0   ROOT   4a92c3d1-81f2-4e02-990a-1123456789ab   18.2G    48% /
└─sda2 xfs          HOME   9f8e7d6c-5b4a-3210-fedc-ba9876543210   82.4G    12% /home

Field 4: Critical Mount Options in /etc/fstab

  • defaults: Expands automatically to: rw,suid,dev,exec,auto,nouser,async.
  • nofail: Prevents system boot failure and avoids dropping to emergency mode if the device is disconnected or fails to mount.
  • _netdev: Instructs systemd and init scripts to delay mounting until network connectivity is active (mandatory for NFS, iSCSI, and CIFS shares).
  • usrquota / grpquota: Enables user or group disk quota enforcement on ext4/XFS filesystems.

Field 6: Fsck Pass Order Rules (Exam Hotspot)

The sixth column determines how fsck behaves at boot:

  • 1: Root filesystem (/) ONLY. The root filesystem must be checked first before any other services or mounts initialize.
  • 2: All other local filesystems requiring boot-time integrity scans (e.g., /home, /var). All filesystems marked 2 are checked in parallel across physical spindles.
  • 0: Disable fsck scanning. Mandatory for:
    • Swap partitions (swap)
    • Virtual filesystems (proc, sysfs, tmpfs)
    • Optical media and ISOs (iso9660)
    • Network shares (nfs, cifs)
    • Filesystems with internal journal replay engines that do not use fsck at boot, such as XFS and Btrfs.

⚠️ LPIC-1 Trap — Setting Fsck Pass Order for XFS: XFS has its own built-in metadata journaling and repair mechanisms executed during kernel mount. It does not run traditional fsck at boot. Setting column 6 to 1 or 2 for an XFS filesystem is an error; XFS entries in /etc/fstab should always have pass order set to 0.


3. Safe Workflow for Modifying /etc/fstab

A syntax error in /etc/fstab (such as a missing column, a typo in a UUID, or an invalid mount option) can prevent the system from completing boot, forcing it into an emergency root shell.

Best Practice Procedure:

  1. Always create a backup before editing: sudo cp /etc/fstab /etc/fstab.bak.
  2. Add or modify the entry using a text editor.
  3. Test the configuration immediately without rebooting by executing:
    $ sudo mount -a
    
  4. If mount -a returns zero errors and mounts the target successfully, the configuration is safe for reboot.

💡 LPIC-1 Exam Fill-in-the-Blank Alert: Which command reads /etc/fstab and mounts all listed filesystems that do not have the noauto option, allowing administrators to verify syntax without rebooting? Answer: mount -a


4. systemd Mount Units and systemd-fstab-generator

In modern systemd-based Linux systems, filesystem mounting is managed natively by systemd unit files ending in .mount and .automount.

How systemd Integrates with /etc/fstab

During early boot, systemd invokes an internal binary called systemd-fstab-generator. This tool parses /etc/fstab and automatically generates native .mount unit files inside the transient runtime directory /run/systemd/generator/.

systemd-fstab-generator Workflow:
 ┌──────────────┐      systemd-fstab-generator      ┌────────────────────────────────┐
 │  /etc/fstab  │ ─────────────────────────────────>│  /run/systemd/generator/       │
 └──────────────┘         (Executed at boot)        │  ├── var-log.mount             │
                                                    │  └── home.mount                │
                                                    └────────────────────────────────┘

Mount Unit Naming Convention (systemd-escape)

Systemd requires that .mount unit filenames strictly match the path of the mount point directory, with leading slashes stripped and all internal slashes replaced by dashes (-):

  • Mount point /-.mount
  • Mount point /homehome.mount
  • Mount point /var/logvar-log.mount
  • Mount point /srv/web/datasrv-web-data.mount

Administrators can generate properly escaped unit names using the systemd-escape command:

$ systemd-escape --path /var/log
var-log

$ systemd-escape --path --suffix=mount /srv/web/data
srv-web-data.mount

Inspecting and Managing Mount Units via systemctl

# List all active mount units:
$ systemctl list-units --type=mount

# View the status of the /var/log mount unit generated from fstab:
$ systemctl status var-log.mount

# Reload systemd generators after editing /etc/fstab without rebooting:
$ sudo systemctl daemon-reload
Loading diagram...
Persistent Mount Architecture: /etc/fstab to systemd Mount Units
Test Your Knowledge

An administrator is adding a new local XFS data partition mounted at /data to /etc/fstab. What integer value should be specified in the sixth column (fsck pass order)?

A
B
C
D
Test Your Knowledge

A junior administrator edited /etc/fstab to mount a new secondary NVMe drive. Before rebooting the production server, which command should be executed to verify that the /etc/fstab syntax is valid and mount all configured partitions?

A
B
C
D
Test Your Knowledge

In a systemd-based Linux distribution, which systemd unit name corresponds to a persistent mount point configured at /var/log?

A
B
C
D