LinuxXV · /etc/fstab and Mount ManagementMount options
Mount options and systemd integration
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
Mount options affect performance, security, and reliability. Choosing the right options is the difference between a healthy filesystem and a chronic problem.
Performance options
$ mount -o noatime,data=ordered /dev/sda1 /dataMount 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)
| Option | Effect | Trade-off |
|---|---|---|
noatime | Skip access-time updates | Performance win, breaks atime-based backup and cleanup tools |
relatime | Update atime only if older than mtime/ctime, or older than 24h | Compromise; the kernel default |
strictatime | Always update atime | Classic POSIX behaviour, most write amplification |
ext4-only
| Option | Effect | Trade-off |
|---|---|---|
data=writeback | Data may reach disk after its metadata is journalled; ordering is not preserved | Fastest; stale or garbage blocks can appear inside files after a crash |
data=ordered | Data is forced to disk before its metadata is journalled (the ext4 default) | Slightly slower; no stale-data exposure after a crash |
data=journal | File data goes through the journal too | Slowest; survives a crash with no data loss window |
barrier | Enabled by default. Enforces journal-commit ordering through the device write cache | Leave it on. barrier=0 disables it and makes a volatile write cache unsafe |
XFS-only
| Option | Effect | Trade-off |
|---|---|---|
allocsize=64k | Speculative pre-allocation size hint | Tunes large sequential writes; wrong values waste space |
logbsize=256k | Larger in-memory log buffer | Fewer log I/Os on metadata-heavy workloads |
inode64 | Allow inodes anywhere in the filesystem | Default since 3.7; only relevant on very old kernels |
Reliability options
$ mount -o errors=remount-ro,data=journal /dev/sdb1 /dataEverything 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.
| Option | Effect | When to use |
|---|---|---|
errors=remount-ro | Remount read-only on errors | All ext-family production data filesystems |
errors=continue | Log and continue | Read-only mounts; never on writable data |
errors=panic | Kernel panic on errors | Embedded/regulated systems |
data=journal | Full data journalling | Critical data, write-mostly |
data=ordered | ext4 default; metadata journalled, data flushed before the metadata commit | Most workloads |
data=writeback | Fastest; data may land after the metadata commit, so a crash can expose stale blocks | Scratch 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
$ mount -t nfs -o _netdev,x-systemd.automount,vers=4.1,sec=krb5 nfs01.example.com:/export/data /srv/nfssystemd 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:
$ systemctl cat tmp.mount 2>/dev/null | head -20Knowledge check
Knowledge check · 5 questions
Q1. What is the effect of the errors=remount-ro mount option?
Q2. Adding _netdev to a network mount prevents the boot from hanging if the network is not yet up.
Q3. Which of the following are correct mount options for production? Select all that apply.
Q4. On ext4, what does data=ordered guarantee that data=writeback does not?
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.