Configuring /etc/fstab: Mount Options and Boot Behavior
The /etc/fstab file defines how Linux mounts filesystems at boot and controls mounting behavior for both the system and individual users. Understanding its format and options is essential for reliable storage management.
File Format and Fields
Each line in /etc/fstab represents one filesystem. Fields are separated by whitespace (tabs or spaces), and lines beginning with # are comments. Blank lines are ignored.
The six fields are:
| Field | Name | Purpose |
|---|---|---|
| 1 | fs_spec | Block device path, UUID, LABEL, or remote filesystem |
| 2 | fs_file | Mount point (directory) |
| 3 | fs_vfstype | Filesystem type (ext4, btrfs, nfs, tmpfs, etc.) |
| 4 | fs_mntops | Mount options (comma-separated, no spaces) |
| 5 | fs_freq | Dump frequency for backup (0 to disable) |
| 6 | fs_passno | fsck check order at boot (0 to skip, 1 for root, 2+ for others) |
Example entry using UUID:
UUID=a1b2c3d4-e5f6-7890-abcd-ef1234567890 /home ext4 defaults 0 2
Using UUIDs or LABELs is more reliable than device names like /dev/sda1, which can change if hardware is reordered. Find UUIDs with blkid:
sudo blkid
Testing Before Reboot
Always validate /etc/fstab changes before rebooting to avoid boot failures:
sudo mount -a
This mounts or remounts all entries in /etc/fstab. Use verbose output to see what’s happening:
sudo mount -a -v
On systemd systems, generate and inspect the resulting mount units:
systemctl list-unit-files --type=mount
systemctl status mnt-example.mount
Check for obvious syntax errors by viewing the systemd generator output:
systemd-fstab-generator /tmp/test-gen
cat /tmp/test-gen/mnt-example.mount
Common Mount Options
Understanding these options helps configure secure and reliable mounts:
| Option | Effect |
|---|---|
rw |
Read-write (default for most filesystems) |
ro |
Read-only |
auto |
Mount automatically at boot (default if omitted) |
noauto |
Mount only on demand, not at boot |
user |
Allow non-root users to mount/unmount |
nouser |
Only root can mount (default) |
suid |
Honor setuid bits on executables (default) |
nosuid |
Ignore setuid bits (improves security) |
exec |
Allow binary execution (default) |
noexec |
Block binary execution |
dev |
Interpret character/block devices (default) |
nodev |
Ignore device files |
async |
Asynchronous I/O (default, faster) |
sync |
Synchronous I/O (safer, slower) |
nofail |
Don’t halt boot if device is missing |
x-systemd.automount |
Mount on first access (systemd only) |
x-systemd.device-timeout=10s |
Timeout waiting for device to appear |
The defaults shorthand expands to rw,suid,dev,exec,auto,nouser,async on most systems.
Allowing Non-Root Users to Mount Filesystems
By default, only root can mount filesystems. Grant specific users mount permissions by adding user and noauto to mount options:
/dev/sdb1 /mnt/external vfat user,noauto,rw 0 0
Now any user can mount and unmount this filesystem:
mount /mnt/external
umount /mnt/external
The noauto option prevents automatic mounting at boot. If you want it to mount automatically for all users but still allow unmounting, use nofail instead (though this is less common):
/dev/sdb1 /mnt/external vfat defaults 0 0
For security on shared systems, consider restricting options:
/dev/sdb1 /mnt/external vfat user,noauto,ro,nosuid,nodev,noexec 0 0
This allows users to mount read-only with no execution or device access—useful for untrusted USB drives.
Handling Non-Critical Filesystems
Non-critical filesystems (backups, optional storage, slow network mounts) should not block boot if they’re unavailable.
Option 1: noauto — Manual or Scheduled Mounting
Add noauto to skip automatic mounting:
UUID=backup-drive-uuid /mnt/backup ext4 noauto,rw,defaults 0 0
Mount manually when needed:
mount /mnt/backup
Or automate mounting with a systemd unit. Create /etc/systemd/system/mnt-backup.mount:
[Unit]
Description=Backup Drive
After=local-fs.target
# Don't start on boot; let user or service request it
[Mount]
What=UUID=backup-drive-uuid
Where=/mnt/backup
Type=ext4
Options=rw,defaults
[Install]
WantedBy=multi-user.target
Enable and start it:
sudo systemctl daemon-reload
sudo systemctl enable mnt-backup.mount
sudo systemctl start mnt-backup.mount
Option 2: x-systemd.automount — Mount on First Access
The x-systemd.automount option mounts a filesystem lazily—when something first tries to access it—reducing boot time:
UUID=large-disk-uuid /mnt/large-disk ext4 noauto,x-systemd.automount,rw,defaults 0 0
Systemd creates an automount unit that transparently mounts the filesystem when accessed, then unmounts it after idle time.
Option 3: nofail — Continue Boot if Device Missing
The nofail option allows boot to proceed even if the device doesn’t exist:
UUID=optional-disk-uuid /mnt/backup ext4 nofail,rw,defaults 0 0
/dev/sdc1 /mnt/usb vfat nofail,user,noauto 0 0
This is useful for removable media and network mounts that may not be available at boot. The filesystem mounts normally if present; boot continues unaffected if absent.
Combine nofail with noauto for optional mounts users trigger manually:
server.example.com:/backup /mnt/nfs-backup nfs nofail,noauto,vers=4.2,hard 0 0
NFS-Specific Considerations
For NFS mounts, modern options improve performance and reliability:
server.example.com:/export /mnt/nfs nfs vers=4.2,hard,timeo=30,retrans=3,nosuid,nodev,noexec 0 0
- vers=4.2: Use NFS 4.2 (much faster and more secure than NFS 3)
- vers=4.1: Acceptable fallback for older servers
- hard: Retry indefinitely on server failure (default; use
softonly if you understand the risks) - timeo=30: RPC timeout in deciseconds (default 600 = 60 seconds); reduce for LAN, increase for WAN
- retrans=3: Number of retries before failing
- nosuid, nodev, noexec: Security hardening options
For user-mountable NFS:
server.example.com:/share /mnt/netshare nfs noauto,user,ro,vers=4.2,hard,timeo=30,nosuid,nodev,noexec 0 0
This allows users to mount read-only and prevents execution of binaries or device access—appropriate for untrusted or shared mounts.
Troubleshooting Mount Failures
If a mount fails, check several things:
# Verify the UUID exists and matches the device
sudo blkid
# Test mount manually to see detailed errors
sudo mount -v UUID=abc123 /mnt/test
# Check filesystem health
sudo fsck -n /dev/sdX1
# For NFS, verify connectivity to the server
showmount -e server.example.com
sudo mount -vvv -t nfs -o vers=4.2 server.example.com:/export /mnt/test
# Review systemd journal for mount errors
journalctl -u mnt-example.mount -n 50
journalctl -b -p err
When modifying fstab, always test with mount -a and check systemctl status for any units in failed state before rebooting.
Refer to man fstab, man mount, and filesystem-specific pages like man nfs for complete option documentation on your system.

Update on Apr. 11, 2015: add default options.
`nofail` is another useful option if the device specified in an entry may not exist during boot: