Skip to main content
RunBook Academy

LinuxXV · /etc/fstab and Mount ManagementMount options

Mount options and systemd integration

Intermediate⏱ ~10 minbashmountsystemctlfindmnt

What you'll learn

  • Choose the right mount options for production workloads
  • Use _netdev, nofail, and noauto correctly
  • Understand systemd fstab-generator behavior
  • Diagnose fstab-mount failures at boot

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

Mount options affect performance, security, and reliability. Choosing the right options is the difference between a healthy filesystem and a chronic problem.

Performance options

Configuration changeperformance mount options
$ mount -o noatime,data=ordered /dev/sda1 /data

Mount options are per-filesystem. noatime and relatime apply everywhere; data= and barrier are ext4 keywords; allocsize= is XFS. Mixing them in one fstab entry produces a mount failure, so keep the two sets straight.

Generic (ext4, XFS, and most others)

OptionEffectTrade-off
noatimeSkip access-time updatesPerformance win, breaks atime-based backup and cleanup tools
relatimeUpdate atime only if older than mtime/ctime, or older than 24hCompromise; the kernel default
strictatimeAlways update atimeClassic POSIX behaviour, most write amplification

ext4-only

OptionEffectTrade-off
data=writebackData may reach disk after its metadata is journalled; ordering is not preservedFastest; stale or garbage blocks can appear inside files after a crash
data=orderedData is forced to disk before its metadata is journalled (the ext4 default)Slightly slower; no stale-data exposure after a crash
data=journalFile data goes through the journal tooSlowest; survives a crash with no data loss window
barrierEnabled by default. Enforces journal-commit ordering through the device write cacheLeave it on. barrier=0 disables it and makes a volatile write cache unsafe

XFS-only

OptionEffectTrade-off
allocsize=64kSpeculative pre-allocation size hintTunes large sequential writes; wrong values waste space
logbsize=256kLarger in-memory log bufferFewer log I/Os on metadata-heavy workloads
inode64Allow inodes anywhere in the filesystemDefault since 3.7; only relevant on very old kernels

Reliability options

Configuration changereliability mount options (ext4 only)
$ mount -o errors=remount-ro,data=journal /dev/sdb1 /data

Everything in the table below is ext2/3/4 only. XFS has no errors= mount option at all; its error handling is configured after mount, through sysfs.

OptionEffectWhen to use
errors=remount-roRemount read-only on errorsAll ext-family production data filesystems
errors=continueLog and continueRead-only mounts; never on writable data
errors=panicKernel panic on errorsEmbedded/regulated systems
data=journalFull data journallingCritical data, write-mostly
data=orderedext4 default; metadata journalled, data flushed before the metadata commitMost workloads
data=writebackFastest; data may land after the metadata commit, so a crash can expose stale blocksScratch and rebuildable bulk data only

The XFS equivalent

XFS is the RHEL-family default, so on half the fleet none of the above applies. An fstab entry carrying errors=remount-ro on an XFS filesystem does not mount, and the failure surfaces at boot, on the console, with the filesystem missing.

XFS configures error handling per mounted filesystem through sysfs instead, under /sys/fs/xfs/<dev>/error/:

# How many times to retry a failed metadata write before giving
# up and shutting the filesystem down. -1 means retry forever,
# which is the default for some error classes.
cat /sys/fs/xfs/sdb1/error/metadata/EIO/max_retries
cat /sys/fs/xfs/sdb1/error/metadata/EIO/retry_timeout_seconds

# Fail fast instead of retrying forever - the setting that
# matters on unreliable SAN or iSCSI storage, where "retry
# forever" turns a transient path loss into a hung host.
echo 5 | sudo tee /sys/fs/xfs/sdb1/error/metadata/EIO/max_retries

# Whether unmount is allowed to hang waiting for those retries.
# 1 (the default) forces immediate failure at unmount time.
cat /sys/fs/xfs/sdb1/error/fail_at_unmount

These are runtime settings and do not survive a reboot. Apply them from a systemd unit ordered after the mount, or from a tmpfiles rule, if you want them to persist.

Network filesystem options

Configuration changeNFS mount options
$ mount -t nfs -o _netdev,x-systemd.automount,vers=4.1,sec=krb5 nfs01.example.com:/export/data /srv/nfs

systemd fstab-generator

systemd can mount filesystems without an explicit fstab entry by generating mount units from fstab on the fly. This is useful for complex mounts:

Configuration changesystemd fstab-generator
$ systemctl cat tmp.mount 2>/dev/null | head -20

Knowledge check

Knowledge check · 5 questions

  1. Q1. What is the effect of the errors=remount-ro mount option?

  2. Q2. Adding _netdev to a network mount prevents the boot from hanging if the network is not yet up.

  3. Q3. Which of the following are correct mount options for production? Select all that apply.

  4. Q4. On ext4, what does data=ordered guarantee that data=writeback does not?

  5. Q5. A vendor tuning guide tells you to add barrier=0 to the XFS data volume on a fleet of hypervisors. What happens when you deploy it to /etc/fstab and the hosts reboot?

Passing score: 75%. Answers are checked in this browser.