How does /etc/fstab work and what are important mount options?
Answer
/etc/fstab defines filesystems to be mounted automatically at boot. Each line has six fields: device mountpoint fstype options dump pass. The device can be a path (/dev/sda1) or UUID (UUID=abc123) — always prefer UUIDs as they are stable across reboots and disk reorders. Important mount options: defaults (rw, suid, dev, exec, auto, nouser, async), noexec (prevents executing binaries — use on /tmp for security), nosuid (ignores setuid bits), noatime (disables access time updates — significant performance improvement for databases and high-traffic filesystems), ro (read-only), _netdev (wait for network before mounting — for NFS). Test fstab changes with mount -a before rebooting. The pass field (0/1/2) controls fsck order on boot.
Previous
What is LVM (Logical Volume Manager) and what problems does it solve?
Next
How do sysctl kernel parameters work and what are important tuning examples?
More Linux / Shell Scripting Questions
View all →- Advanced What are Linux namespaces and cgroups, and how do they underpin containers?
- Advanced How do iptables and nftables handle packet filtering rules?
- Advanced What is LVM (Logical Volume Manager) and what problems does it solve?
- Advanced How do sysctl kernel parameters work and what are important tuning examples?
- Advanced How do you use perf and flame graphs for performance analysis on Linux?