/etc/fstab, the filesystem table, declares filesystems, swap areas, bind mounts, network sources, and other attachments that system tools may mount or activate. Entries can participate in boot, but options such as noauto, automount integration, and service-manager policy affect when or whether that happens.
The Filesystem · Lesson 7
/etc/fstab
Learn how to define persistent filesystem and swap attachments in `/etc/fstab` and validate them safely.
The Six Fields
A conventional entry has six whitespace-separated fields:
UUID=130b882f-7d79-436d-a096-1e594c92bb76 /data ext4 defaults,nosuid,nodev 0 2
- Source: a device path,
UUID=,LABEL=, network source, or another supported specification. - Target: mount point, or
nonefor uses such as swap where appropriate. - Type: filesystem type,
swap,none, or an accepted automatic type. - Options: a comma-separated list interpreted by mount helpers and integration layers.
- Dump field: historically controls the
dumpbackup utility;0commonly disables participation. - Pass field: controls boot-time
fsckordering where applicable;0disables automatic checking through this mechanism.
Whitespace inside a field must be escaped using fstab syntax such as \040 for a space. A # begins a comment outside a field.
How many fields does a normal /etc/fstab entry contain?
Stable Source Identifiers
For local filesystems, a filesystem UUID is often more stable than /dev/sdX enumeration:
$ lsblk -f
$ sudo blkid
Use UUID=... only after confirming the identifier belongs to the intended filesystem. Reformatting creates a new UUID, and block-level clones can duplicate one. PARTUUID= instead identifies a partition-table entry and has different semantics.
What does UUID=... in the source field normally identify?
Mount Options and Check Fields
defaults expands to an implementation-defined conventional option set; it is not necessarily the safest policy for every mount. Add options based on trust and workload, such as read-only access or restrictions on device nodes and setuid behavior. Network and removable filesystems can need timeout, dependency, or failure-tolerance policy so boot does not stall unexpectedly.
For filesystems supported by fsck, the root filesystem conventionally uses pass 1 and other checked local filesystems pass 2. Filesystem-specific practice can differ—for example, some types do not use generic boot-time fsck—so follow the installed filesystem and distribution documentation rather than assigning 2 mechanically.
What does a sixth-field value of 0 request?
Editing with a Recovery Path
An invalid root, boot, or required network entry can interrupt startup. Before editing:
- Confirm a current backup and console or rescue access.
- Copy the existing file while preserving permissions.
- Verify source identity and create the intended mount point.
- Make one scoped change.
- Validate and test before rebooting.
Do not put credentials directly in a world-readable fstab entry. Use the relevant mount helper's protected credential mechanism.
Why should rescue access be confirmed before changing a critical fstab entry?
Validating Without Assuming Success
Start with a static check where supported:
$ sudo findmnt --verify --verbose
Then test the specific new entry under controlled conditions, confirm it with findmnt, and unmount if the test was temporary. mount -a attempts many eligible entries and can contact networks or attach unintended sources; it also skips already mounted and noauto entries, so it is neither a harmless syntax checker nor complete proof.
On systemd-based systems, reload manager configuration after editing fstab so generated mount units are refreshed, then verify dependencies and boot behavior according to local documentation.
Why is mount -a not a complete fstab validation by itself?
Practice in Manage Linux Partitions and Filesystems with the lab's recovery-safe secondary storage.
Lesson complete
You finished /etc/fstab
You can now read and validate a persistent filesystem-table entry.
Parse source, target, type, options, dump, and pass fields.
Select a verified identifier with the intended identity semantics.
Choose mount and checking policy for the actual filesystem.
Preserve rescue access and make one scoped edit.
Combine static validation, targeted mounting, and boot-policy checks.
Keep your learning progress
Create a free account to save this lesson and continue learning on any device.
Create a free account