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>
PositionField nameTypical valuesPurposeCommon cautions
1SourceUUID=..., /dev/sda1, server:/exportIdentifies the device or remote resourcePrefer stable identifiers for local disks
2Target/, /home, /mnt/dataDirectory where the file system appearsThe directory must exist
3File-system typeext4, xfs, nfs, swapIdentifies the on-disk or virtual formatOptions depend on this type
4Mount optionsdefaults, ro, nofailControls access, security, and mount behaviorSeparate options with commas
5Dump flag0, 1Controls consideration by the legacy dump backup utilityUsually 0 today
6fsck pass0, 1, 2Controls boot-time consistency-check orderNot 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.

FormatExampleStabilityBest use caseLimitations
Device path/dev/sda1LowerTemporary tests or known fixed layoutsThe kernel name may change
UUID=UUID=1234...Generally highMost persistent local file-system mountsChanges if the file system is recreated
LABEL=LABEL=ArchiveDepends on uniquenessReadable administrative configurationsLabels can be duplicated or changed
PARTUUID=PARTUUID=abcd...Generally highIdentifying a partition itselfIdentifies the partition, not its contained file system
PARTLABEL=PARTLABEL=DataDepends on uniquenessPartition-table labelsLabels 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 caseTypeSuggested source formMount-point exampleExample options
Linux-native general storageext4UUID=.../mnt/datadefaults
Linux-native server storagexfsUUID=.../srv/datadefaults
Copy-on-write Linux storagebtrfsUUID=.../homeType-specific options
Interoperable removable storagevfat, exfatUUID=.../media/usbuid=...,gid=...,umask=022
Windows-compatible storagentfs3UUID=.../mnt/windowsDriver-specific options
SwapswapUUID=...nonesw
Network storagenfs, cifsserver:/export or //server/share/mnt/shareNetwork-specific options
Virtual system resourcestmpfs, proc, sysfs, devptsSpecial sourceSystem directoriesSystem-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.

OptionMeaningTypical usePotential side effectApplicable types
rw / roRead-write or read-onlyNormal data or protected archivesWrites fail with roMany file systems
exec / noexecAllow or prevent execution from the mountReduce risk on data volumesPrograms and scripts may stop workingMany local mounts
suid / nosuidAllow or ignore set-user-ID and set-group-ID bitsUntrusted removable mediaSome software may require these bitsMany local mounts
dev / nodevAllow or reject device nodesData and removable volumesDevice nodes on the volume cannot be usedMany local mounts
nofailDo not make absence fatal during bootOptional disks and removable mediaStorage may silently remain unavailableCommonly systemd-managed mounts
x-systemd.device-timeout=10sLimits waiting for a deviceSlow or optional local devicesToo short a value can cause premature failuresystemd systems
x-systemd.automountMount on first accessDelayed data storageFirst access may wait or report an errorsystemd systems
user, usersAllow non-root mounting; users broadens unmount permissionRemovable mediaUsers can expose untrusted contentMany mount helpers
ownerPermit the device owner to mountSome removable devicesDepends on device ownership behaviorCommonly block devices
noautoExclude from automatic mountingManually mounted USB or backup mediamount -a will skip itMost mountable types
uid=, gid=Displayed owner and groupFAT-family and similar mediaOne configured owner/group applies broadlyDriver-dependent
umask=, dmask=, fmask=Removes permission bits from all objects, directories, or filesControl access on FAT/exFAT mediaAn overly restrictive mask blocks accessDriver-dependent
discardRequests discard/TRIM behaviorSome SSD-backed storageMay affect performance, endurance, or compatibilityDepends 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.

ValueMeaningTypical placementNotes
0No automatic fsck passSwap, network, virtual, and types without classic fsck useDoes not mean the file system can never be checked manually
1Check firstRoot file systemUsually reserved for /
2Check after pass 1Other eligible local file systemsEqual 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

  1. Identify the intended partition or file system with lsblk -f, sudo blkid, or findmnt.
  2. Confirm that the file system is the correct one. Do not run a formatting command on a disk containing needed data.
  3. Create the target directory with sudo mkdir -p.
  4. Back up the configuration.
  5. Edit it with a privileged editor.
  6. Run sudo mount -a before rebooting.
  7. Inspect the actual result with findmnt, df -hT, or lsblk -f.
  8. Reverse a test with sudo umount /path if 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

  • findmnt shows active sources, targets, types, and effective options in a structured form.
  • mount lists mounts on many systems and can mount a configured target such as sudo mount /mnt/data.
  • df -hT shows mounted capacity and file-system types.
  • lsblk -f connects devices, partitions, labels, UUIDs, types, and current targets.
  • mount -a attempts eligible entries and is a practical pre-reboot test. It skips entries marked noauto.
  • sudo umount /mnt/data unmounts by target; sudo umount /dev/sdb1 can 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 from PARTUUID=.
  • The target directory must exist, and mounting hides any original contents beneath that directory until unmounting.
  • Options are comma-separated; nofail makes an unavailable mount non-fatal, while noauto prevents automatic mounting.
  • Common dump values are 0 and 1; common fsck values are 0, 1 for root, and 2 for other eligible local file systems.
  • Back up /etc/fstab, run sudo mount -a, inspect with findmnt, and do not reboot with an untested mandatory entry.

For a concise reference, return to the /etc/fstab file guide.