fstab

Also known as: /etc/fstab

On this page 7

fstab, the file /etc/fstab, is the static filesystem table of a Linux system: a plain-text configuration file that lists which block devices, partitions, network shares and swap areas should be mounted, at which mount point, with which filesystem type and options. During boot the system reads it to assemble the directory tree from separate storage volumes, and tools such as mount consult it when an administrator mounts a filesystem by its mount point alone.

The file describes the intended, persistent state, not what is mounted right now. The live state is visible in /proc/mounts or through findmnt, and a difference between the two often points to a failed or manual mount.

The six fields of an fstab entry

Each non-comment line in fstab describes one filesystem in six whitespace-separated fields. Lines beginning with a hash sign are comments, and spaces inside paths must be written as the octal escape \040.

FieldMeaningExample value
1. DeviceWhat to mount, ideally by stable identifierUUID=3f2a..., LABEL=data, server:/export
2. Mount pointDirectory where it appears/, /home, /mnt/backup, none for swap
3. TypeFilesystem typeext4, xfs, btrfs, nfs, swap, tmpfs
4. OptionsComma-separated mount optionsdefaults,noatime
5. DumpLegacy backup flag for the dump utilityAlmost always 0
6. PassOrder of the boot-time fsck check1 for root, 2 for others, 0 to skip
Fields of an fstab line

A complete line for a data partition might read UUID=3f2a... /srv ext4 defaults,noatime 0 2. The pass field matters for ext-family filesystems; XFS and Btrfs perform their own consistency handling, so they are usually given 0 in that field.

Identifying devices reliably

Kernel device names such as /dev/sdb1 are assigned in detection order and can change when disks are added, removed or connected through a different controller. A system that mounts by such names may boot with the wrong disk in place or fail entirely. Modern installers therefore write persistent identifiers into fstab.

ReferenceSource of the valueStabilityNote
UUID=Filesystem UUID, shown by blkidHighChanges when the filesystem is recreated
PARTUUID=GPT partition identifierHighSurvives reformatting of the partition
LABEL=Filesystem label set by the adminMediumDuplicate labels cause conflicts
/dev/disk/by-id/Hardware serial-based symlinkHighTied to one physical disk
/dev/sdXKernel enumeration orderLowAvoid for permanent mounts
LVM or mapper pathVolume group and logical volume namesHighStable while names stay unchanged
Ways to reference a device in fstab

Identifiers have their own trap. Cloning a disk with a block-level copy also clones its UUID, so two filesystems with the same identifier can appear on one machine and the wrong one may be mounted. After cloning, administrators assign a new UUID with the filesystem’s own tool, such as tune2fs -U for ext4 or xfs_admin -U for XFS, and update fstab to match.

Network filesystems are referenced differently: an NFS entry names the server and exported path, and a CIFS entry names a share such as //server/share. Credentials for CIFS should be kept in a separate file readable only by root and referenced with the credentials= option, never written directly into fstab, which every user can read.

Mount options that matter in practice

The options field controls behavior, performance and security of each mount. The keyword defaults expands to rw, suid, dev, exec, auto, nouser and async; additional options are appended after it.

OptionEffectTypical use
noatimeStops access-time updates on readsReduces writes on busy or flash storage
nofailBoot continues if the device is missingExternal or secondary disks
_netdevWaits for networking before mountingNFS, CIFS and iSCSI volumes
x-systemd.automountMounts on first access instead of at bootNetwork shares and slow devices
noexec, nosuid, nodevBlock programs, setuid bits or device filesHardening /tmp and user-writable mounts
roRead-only mountRecovery images and protected data
user or usersLets ordinary users mount the entryRemovable media on desktops
Frequently used fstab options

Filesystem-specific options are added in the same field, for example subvol=@home,compress=zstd for Btrfs subvolumes or size=2G for a tmpfs mount. Options a filesystem does not recognize usually make the mount fail.

How fstab is processed at boot

On distributions that use systemd, fstab is not read by a traditional script. The systemd-fstab-generator converts every line into a native mount unit or swap unit early in boot, and systemd then orders those units by dependencies. This is why changes to fstab require systemctl daemon-reload before they take effect for systemd-managed mounting.

Entries for the root filesystem and for filesystems needed by local-fs.target are critical by default: if one cannot be mounted, boot stops in emergency mode. Adding nofail to non-essential entries prevents a missing USB disk or an unreachable NAS from blocking the whole system.

Editing fstab safely

A single typo in fstab can make a server unbootable, so experienced administrators follow a fixed routine before rebooting.

  1. Back up the file before editing, for example to /etc/fstab.bak.
  2. Copy identifiers from `blkid` or `lsblk -f` rather than typing them by hand.
  3. Run findmnt --verify to detect syntax and type errors.
  4. Run systemctl daemon-reload and then mount -a to mount all new entries without rebooting.
  5. Confirm the result with findmnt or df -h before the next restart.

On remote or cloud machines without console access, a broken fstab can mean a lost server, because emergency mode waits for a local login. Marking new data volumes with nofail and testing with mount -a are therefore not optional precautions but standard operating practice.

A plain-language summary

fstab is a short list that tells Linux where to attach each disk when the computer starts. A computer may have several drives, partitions or network folders. Linux joins them into one tree of folders, and fstab says which piece goes where.

It works like a seating plan for a dinner. Each guest, meaning each disk, has a named seat, meaning a folder. If the plan has a mistake, the evening can start badly, and the computer may refuse to start normally until someone corrects the list.

An example from practice

An administrator adds a new 2 TB data disk to a web server and wants it permanently available at /srv/data. She formats it with ext4, runs blkid to read its UUID and appends one line: the UUID, /srv/data, ext4, the options defaults,noatime,nofail, then 0 and 2.

Before rebooting, she runs findmnt --verify, which reports no problems, then systemctl daemon-reload and mount -a. The disk appears at /srv/data with the expected size. Weeks later the disk fails and is removed for replacement. Thanks to nofail, the server still boots normally and keeps serving the website, while monitoring reports the missing mount to the team.