VMware ESXi and vSphere Cluster Management
Linux /etc/fstab: Persistent File System Mount Configuration
Learn to read and safely edit Linux /etc/fstab entries, use all six fields, configure persistent disks and removable media, and validate mounts without rebooting.
What /etc/fstab Does
/etc/fstab is Linux's system-wide static file-system table. It describes file systems and related resources that should be attached to directories, enabled as swap, or otherwise considered by mounting tools.
Mounting attaches a file system to a directory in the Linux directory tree. The directory is called the mount point. During startup, the operating system and, on many distributions, systemd read the desired relationships in /etc/fstab and create the corresponding mounts.
The mount command also uses the file. For example, mount /mnt/data can find the matching entry by its target. mount -a attempts all eligible entries from /etc/fstab.
Administrators commonly update the file after adding disks, creating partitions, formatting storage with mkfs, changing identifiers, or preparing persistent network and removable-storage mounts. A file system created with mkfs.ext4, for example, still needs a mount relationship before its files are available through a chosen directory.
Reading the File
One non-comment line normally describes one file system, swap area, or special file system. Fields are separated by whitespace. Multiple mount options in the fourth field are separated by commas, with no need for spaces.
- A line beginning with
#is a comment and is ignored. - Blank lines are ignored.
- The six fields appear in this order: source, target, type, options, dump flag, and fsck pass number.
<source> <mount-point> <type> <options> <dump> <fsck-pass>
| Position | Field name | Typical values | Purpose | Common cautions |
|---|---|---|---|---|
| 1 | Source | UUID=..., /dev/sda1, server:/export | Identifies the device or remote resource | Prefer stable identifiers for local disks |
| 2 | Target | /, /home, /mnt/data | Directory where the file system appears | The directory must exist |
| 3 | File-system type | ext4, xfs, nfs, swap | Identifies the on-disk or virtual format | Options depend on this type |
| 4 | Mount options | defaults, ro, nofail | Controls access, security, and mount behavior | Separate options with commas |
| 5 | Dump flag | 0, 1 | Controls consideration by the legacy dump backup utility | Usually 0 today |
| 6 | fsck pass | 0, 1, 2 | Controls boot-time consistency-check order | Not every file system uses classic fsck behavior |
Field 1: Source or Device Specification
A source can be a traditional block-device path, a stable identifier, or a network resource. A block device is a disk, partition, or storage mapping accessed in blocks and commonly represented under /dev.
/dev/sda1
/dev/nvme0n1p2
/dev/mapper/vgname-lvname
Device names can change when hardware is added or detected in a different order. For persistent local mounts, use a stable identifier when possible.
| Format | Example | Stability | Best use case | Limitations |
|---|---|---|---|---|
| Device path | /dev/sda1 | Lower | Temporary tests or known fixed layouts | The kernel name may change |
UUID= | UUID=1234... | Generally high | Most persistent local file-system mounts | Changes if the file system is recreated |
LABEL= | LABEL=Archive | Depends on uniqueness | Readable administrative configurations | Labels can be duplicated or changed |
PARTUUID= | PARTUUID=abcd... | Generally high | Identifying a partition itself | Identifies the partition, not its contained file system |
PARTLABEL= | PARTLABEL=Data | Depends on uniqueness | Partition-table labels | Labels may be absent or duplicated |
A UUID normally identifies the file system created by formatting. A PARTUUID identifies the partition in the partition table. They are different identifiers and one cannot always substitute for the other.
Useful non-device sources include server:/export for NFS and //server/share for CIFS/SMB.
lsblk -f
sudo blkid
Field 2: Mount Point or Target
The target is the directory where the mounted file system becomes visible. Common targets include /, /home, /var, /boot, /mnt/data, and /media.
sudo mkdir -p /mnt/data
The target must exist before a normal mount succeeds. Mounting over a non-empty directory temporarily hides the directory's original contents. Those contents become visible again after the file system is unmounted, so inspect a directory before using it as a mount point.
Field 3: File-System Type
The type identifies the on-disk format or a virtual file-system implementation.
| Use case | Type | Suggested source form | Mount-point example | Example options |
|---|---|---|---|---|
| Linux-native general storage | ext4 | UUID=... | /mnt/data | defaults |
| Linux-native server storage | xfs | UUID=... | /srv/data | defaults |
| Copy-on-write Linux storage | btrfs | UUID=... | /home | Type-specific options |
| Interoperable removable storage | vfat, exfat | UUID=... | /media/usb | uid=...,gid=...,umask=022 |
| Windows-compatible storage | ntfs3 | UUID=... | /mnt/windows | Driver-specific options |
| Swap | swap | UUID=... | none | sw |
| Network storage | nfs, cifs | server:/export or //server/share | /mnt/share | Network-specific options |
| Virtual system resources | tmpfs, proc, sysfs, devpts | Special source | System directories | System-specific options |
auto may allow the kernel and mount helpers to detect a type. An explicit type is often clearer and more predictable. Linux-native file systems retain standard Linux ownership and permission metadata. FAT-family and some interoperability-oriented file systems handle ownership and permissions through mount options or driver behavior instead.
Field 4: Mount Options
defaults supplies a conventional baseline. Options are comma-delimited, for example rw,nosuid,nodev. Supported options vary by file-system type; check the relevant manual pages, such as man mount and the type-specific documentation.
| Option | Meaning | Typical use | Potential side effect | Applicable types |
|---|---|---|---|---|
rw / ro | Read-write or read-only | Normal data or protected archives | Writes fail with ro | Many file systems |
exec / noexec | Allow or prevent execution from the mount | Reduce risk on data volumes | Programs and scripts may stop working | Many local mounts |
suid / nosuid | Allow or ignore set-user-ID and set-group-ID bits | Untrusted removable media | Some software may require these bits | Many local mounts |
dev / nodev | Allow or reject device nodes | Data and removable volumes | Device nodes on the volume cannot be used | Many local mounts |
nofail | Do not make absence fatal during boot | Optional disks and removable media | Storage may silently remain unavailable | Commonly systemd-managed mounts |
x-systemd.device-timeout=10s | Limits waiting for a device | Slow or optional local devices | Too short a value can cause premature failure | systemd systems |
x-systemd.automount | Mount on first access | Delayed data storage | First access may wait or report an error | systemd systems |
user, users | Allow non-root mounting; users broadens unmount permission | Removable media | Users can expose untrusted content | Many mount helpers |
owner | Permit the device owner to mount | Some removable devices | Depends on device ownership behavior | Commonly block devices |
noauto | Exclude from automatic mounting | Manually mounted USB or backup media | mount -a will skip it | Most mountable types |
uid=, gid= | Displayed owner and group | FAT-family and similar media | One configured owner/group applies broadly | Driver-dependent |
umask=, dmask=, fmask= | Removes permission bits from all objects, directories, or files | Control access on FAT/exFAT media | An overly restrictive mask blocks access | Driver-dependent |
discard | Requests discard/TRIM behavior | Some SSD-backed storage | May affect performance, endurance, or compatibility | Depends on file system and storage |
user is convenient for removable media, while users allows users generally to unmount a mount created by another user. These options should not be treated as a substitute for a deliberate security policy. noauto prevents normal automatic mounting, but the entry can still be selected explicitly.
Fields 5 and 6: Dump and fsck
The fifth field is the legacy dump backup flag. Use 0 to exclude a file system and 1 to include it. Most current installations use 0 because the dump utility is not part of their backup workflow.
The sixth field is the fsck pass number. It influences boot-time file-system consistency checking.
| Value | Meaning | Typical placement | Notes |
|---|---|---|---|
0 | No automatic fsck pass | Swap, network, virtual, and types without classic fsck use | Does not mean the file system can never be checked manually |
1 | Check first | Root file system | Usually reserved for / |
2 | Check after pass 1 | Other eligible local file systems | Equal nonzero pass values may be checked in parallel where supported |
Modern boot tooling and file-system implementations may not use classic fsck in exactly the same way. Follow the file-system and distribution documentation rather than assuming every type performs a traditional check.
Safe Editing and Validation Workflow
- Identify the intended partition or file system with
lsblk -f,sudo blkid, orfindmnt. - Confirm that the file system is the correct one. Do not run a formatting command on a disk containing needed data.
- Create the target directory with
sudo mkdir -p. - Back up the configuration.
- Edit it with a privileged editor.
- Run
sudo mount -abefore rebooting. - Inspect the actual result with
findmnt,df -hT, orlsblk -f. - Reverse a test with
sudo umount /pathif necessary.
lsblk -f
sudo blkid
sudo mkdir -p /mnt/data
sudo cp /etc/fstab /etc/fstab.bak
sudoedit /etc/fstab
sudo mount -a
findmnt /mnt/data
df -hT
A broken mandatory entry can prevent normal boot or cause emergency mode. Be especially cautious with the root file system, network mounts, encrypted storage dependencies, and any device required for services to start. For a remote system, keep an existing administrative session open while testing so a second connection remains available if boot or networking configuration is affected.
Persistent Local Disk Example
Suppose an ext4 file system has already been created on a data partition. Obtain its actual UUID rather than copying the placeholder below.
sudo blkid /dev/sdb1
sudo mkdir -p /mnt/data
sudoedit /etc/fstab
UUID=12345678-1234-1234-1234-123456789abc /mnt/data ext4 defaults 0 2
The first value is an example only. Replace it with the UUID reported for the target system. The entry says to mount that ext4 file system at /mnt/data, use default options, skip legacy dump backups, and include it in the ordinary non-root fsck pass.
sudo mount -a
findmnt /mnt/data
lsblk -f
df -hT
sudo umount /mnt/data
After the test succeeds, mounting can be performed by target:
sudo mount /mnt/data
Removable USB Storage
Unconditionally requiring a USB disk at boot is usually inappropriate because the device may be unplugged, connected later, or assigned a different device name. nofail prevents an absent optional device from becoming a fatal boot dependency. noauto additionally keeps normal automatic mounting from attempting the entry.
UUID=ABCD-1234 /media/usb exfat nofail,noauto,user,uid=1000,gid=1000,umask=022 0 0
Use the actual UUID and the intended user's numeric values from id; do not assume the user has UID or GID 1000. FAT and exFAT do not preserve standard Linux ownership metadata in the same manner as ext4, so uid=, gid=, and masks determine how ownership and permissions are presented. Some drivers use dmask= and fmask= when separate directory and file policies are needed.
For a device that should mount when present but should not delay boot indefinitely, a systemd-oriented entry can use options such as nofail and x-systemd.device-timeout=10s. x-systemd.automount can create an on-demand mount that activates when the path is accessed:
UUID=12345678-1234-1234-1234-123456789abc /srv/data ext4 nofail,x-systemd.automount,x-systemd.device-timeout=10s 0 2
Automounting is useful for optional data disks, but the first access can wait for the device or fail if it is unavailable.
Other Useful Entries
A read-only archive with reduced execution and device-node risk might use:
UUID=87654321-4321-4321-4321-cba987654321 /srv/archive ext4 ro,nosuid,nodev,noexec 0 2
noexec can prevent applications or scripts stored on the volume from running. These restrictions do not replace backups, file permissions, encryption, or broader access-control planning.
Swap has no ordinary directory target:
UUID=11111111-2222-3333-4444-555555555555 none swap sw 0 0
Network entries require network-specific options and availability planning. Examples of source syntax include server:/export for NFS and //server/share for CIFS. Optional network mounts commonly need nofail and systemd or network-ordering options appropriate to the distribution.
Inspecting, Mounting, and Unmounting
findmntshows active sources, targets, types, and effective options in a structured form.mountlists mounts on many systems and can mount a configured target such assudo mount /mnt/data.df -hTshows mounted capacity and file-system types.lsblk -fconnects devices, partitions, labels, UUIDs, types, and current targets.mount -aattempts eligible entries and is a practical pre-reboot test. It skips entries markednoauto.sudo umount /mnt/dataunmounts by target;sudo umount /dev/sdb1can unmount by source.
An unmount fails when a shell, service, application, or child process is using the target. Leave the directory first, then use fuser or lsof to locate users of it. Stop the relevant processes and retry. Lazy or forced unmounts are advanced recovery actions: they can leave applications with errors or create data-integrity risks.
Boot and systemd Considerations
On systemd-based distributions, systemd generally converts /etc/fstab entries into mount units during boot. Options beginning with x-systemd. provide systemd-specific behavior for device timeouts, automounting, and dependency handling.
Distinguish a boot-critical mount, such as the root file system, from an optional data device. Required entries should be tested carefully because an invalid source, type, option, or target can cause a failed dependency, slow boot, or emergency mode. Optional disks, removable media, and many network resources should be designed not to block startup when unavailable.
If a configuration prevents normal boot, use the distribution's recovery or emergency procedure conceptually: access a root shell or recovery environment, make the affected root file system writable if necessary, restore /etc/fstab.bak or comment out the faulty line, and reboot. Afterward, correct and test the entry before making it mandatory again.
Troubleshooting Common Problems
Mount point does not exist
Check the target spelling in /etc/fstab and inspect it with ls -ld /path. Create it with sudo mkdir -p /path, then rerun sudo mount -a.
Device cannot be found
Compare the entry with lsblk -f and sudo blkid. A copied UUID may be wrong, the device may be disconnected, or a volatile /dev/sdX name may have changed. Correct the stable identifier. For optional storage, consider nofail or noauto.
Boot is slow or enters emergency mode
An invalid mandatory entry, unavailable removable or network storage, unsupported type, or invalid option may be responsible. Inspect failed units and journal messages with journalctl where applicable. Correct or temporarily comment out the line from a recovery environment, then validate with mount -a. For nonessential devices, consider nofail, x-systemd.device-timeout=, or x-systemd.automount.
FAT, exFAT, or NTFS ownership is unexpected
Inspect effective options with findmnt -no OPTIONS /media/usb and compare them with id username. Add appropriate uid=, gid=, umask=, dmask=, or fmask= values for the installed driver and desired access policy.
Unmount reports that the target is busy
Check whether the current shell is inside the mount and use fuser or lsof to find processes using it. Leave the directory or stop the relevant service before retrying umount.
Exam-Relevant Summary
- The six fields are source, target, type, options, dump, fsck pass.
- Use
UUID=for most persistent local mounts; distinguish it fromPARTUUID=. - The target directory must exist, and mounting hides any original contents beneath that directory until unmounting.
- Options are comma-separated;
nofailmakes an unavailable mount non-fatal, whilenoautoprevents automatic mounting. - Common dump values are
0and1; common fsck values are0,1for root, and2for other eligible local file systems. - Back up
/etc/fstab, runsudo mount -a, inspect withfindmnt, and do not reboot with an untested mandatory entry.
For a concise reference, return to the /etc/fstab file guide.