One Line, Six Fields
UUID=your-uuid /mnt/data ext4 defaults,nofail 0 2
| Field | Example | Meaning |
|---|---|---|
| 1. Device | UUID=… | What to mount |
| 2. Mount point | /mnt/data | Where it appears |
| 3. Type | ext4 | File system type |
| 4. Options | defaults | Comma-separated, no spaces |
| 5. Dump | 0 | Old backup flag; leave 0 |
| 6. Pass | 2 | Order of the boot check |
Fields are separated by spaces or tabs. Lines that start with # are comments.
Field 1: Name the Device by UUID
Names such as /dev/vdb1 can change between boots when disks are added or found in another order. The UUID belongs to the file system and stays the same. Find it with:
lsblk -f
sudo blkid /dev/vdb1
LABEL=data also works if the label is unique. LVM volumes can be named by their path, such as /dev/data_vg/data_lv, because LVM names do not depend on the order in which disks are found.
Field 4: Common Options
| Option | Effect |
|---|---|
defaults | The default set: read-write, mounted at boot |
nofail | Boot continues if the disk is missing |
noatime | Reads do not update access times |
ro | Read-only |
noexec | Programs cannot run from it |
_netdev | Needs the network first |
Use nofail on every data disk. Without it, a missing or broken data disk stops the boot in emergency mode. Network file systems also need _netdev.
Fields 5 and 6: Dump and Pass
- Dump:
0on current systems. - Pass
1: the root file system only, checked first. - Pass
2: other ext4 file systems, checked after root. - Pass
0: no check. Use it for XFS, whose fsck step does nothing, and for swap.
Typical Lines
UUID=your-root-uuid / ext4 errors=remount-ro 0 1
UUID=your-data-uuid /mnt/data ext4 defaults,nofail 0 2
UUID=your-xfs-uuid /srv xfs defaults,nofail 0 0
/swapfile none swap sw 0 0
The root line on Debian and Ubuntu often carries errors=remount-ro, which makes the kernel switch to read-only after a file system error; see read-only file system error. The swap line is explained in how to add a swap file.
Edit and Test Safely
A wrong line can stop the server from booting. Keep a copy, edit, and test before any reboot:
sudo cp /etc/fstab /etc/fstab.bak
sudo nano /etc/fstab
sudo findmnt --verify
sudo systemctl daemon-reload
sudo mount -a
findmnt --verify checks that the file can be parsed and that its entries are usable; add --verbose for details. systemd turns fstab into mount units, so daemon-reload makes it read the new file. mount -a mounts everything not yet mounted, so an error shows now rather than at the next boot. Manual mounting is covered in how to mount a drive in Linux.
When the Server Does Not Boot
- Open the server console in your provider's control panel. A failed mount usually ends in emergency mode with a message about a mount or device timeout.
- Log in as root. If root has no password and the console refuses, boot the rescue system from the control panel instead and mount the root partition.
- If the root file system is read-only, run
mount -o remount,rw /so you can edit the file. If the kernel log shows file system errors, repair first instead, as in the fsck guide. - Restore the copy with
cp /etc/fstab.bak /etc/fstab, or comment out the new line. - Reboot and check the boot as in how to reboot a Linux server.