fstab
LINUXLPIC1-101
3/5/2026


Warning: These examples may crash your computer if there is something incorrect. For example, setting the wrong UUID in /etc/fstab will make the system crash or unbootable. Ensure you put the correct values in the /etc/fstab file. The author is not responsible for any damage. It is also recommended to always create a backup of the fstab file before any editing.
The /etc/fstab (file system table) file is a critical configuration file in Linux that tells the system how to mount partitions and storage devices automatically during boot.
It consists of six fields, separated by tabs or spaces.
The 6 Fields of /etc/fstab
Field Name Description Example
1 Device The identifier for the partition (UUID, Label, or /dev path). UUID=123-abc
2 Mount Point The directory where the filesystem will be attached. /home
3 FS Type The type of filesystem (ext4, xfs, vfat, ntfs-3g, swap). ext4
4 Options Specific mount settings (comma-separated, no spaces). defaults,ro
5 Dump Used by the dump utility (0 = skip, 1 = backup). 0
6 FSCK The order in which fsck checks the disk (0=none, 1=root, 2=others). 2
Detailed Breakdown
1. Device (The "What")
While you can use /dev/sda1, modern systems prefer UUID (Universally Unique Identifier) or LABEL. This ensures that even if you move the hard drive to a different SATA port, the system still finds the correct partition.
2. Mount Point (The "Where")
This is the directory where the files will appear.
Note: For swap partitions, this field is simply written as none or swap.
3. Filesystem Type
You must specify the correct driver. Common types include:
ext4: Standard Linux filesystem.
xfs: High-performance 64-bit journaling filesystem.
vfat: Used for EFI partitions or USB sticks.
nfs: For network-attached storage.
4. Mount Options
The defaults option typically includes rw, suid, dev, exec, auto, nouser, and async. Other important flags:
noauto: The partition is not mounted at boot (only when you manually run mount).
user: Allows a non-root user to mount the drive.
ro: Mounts the filesystem as Read-Only.
5. Dump (The "Backup")
This is rarely used today. It’s almost always 0 (do not back up).
6. FSCK (The "Check")
This determines the priority for the filesystem check at boot:
1: Reserved for the root (/) partition.
2: For all other partitions.
0: Do not check (used for swap or network drives).
Tips
If you modify /etc/fstab and want to test it without rebooting, run the command:
mount -a
When editing the file with vi, you may want to insert the output from a command into a file, immediately after the cursor:
:r!command
You can use this to insert the UUID of a disk so you don't have to copy that long string. You can execute something like this:
:r!sudo blkid | grep sr0
Then you can edit the line and remove the unwanted parts.
Contact
hello@unixtips.eu
© 2025. All rights reserved.