Part II · Your system
13.5 fstab and mount options
alsofstab/etc/fstabmountmount optionsumountnofailnoatimeautomount
TL;DR
/etc/fstablists what to mount at boot, one line per filesystem: what, where, type, options, then two numbers.- Name disks by
UUID=…(fromlsblk -f), not/dev/sdb1: device names can change from one boot to the next. - Test a new line before rebooting:
sudo mount -amounts everything listed that isn't mounted yet.
lsblk -f
sudo mount -a
sudo findmnt --verify # checks fstab for mistakes
On your machine
$ atfq 13.5 Entries / (btrfs, subvol=@,noatime) from UUID=3f1c2a9e-8b7d-4e21-9c55-0a6b2d7e9f10 · mounted /boot/efi (vfat, umask=0077) from UUID=7A2C-1F3B · mounted none (swap, defaults) from /swapfile · swap /mnt/nas photos (nfs, noauto,nofail) from nas:/photos · NOT mounted
An example: Alice's laptop, one of the test machines. In your terminal, this block shows your own machine, read live.
Pitfalls
- A wrong line can stop the boot in emergency mode. Add
nofailfor disks that may be missing, such as USB drives and network shares. - After editing fstab, run
sudo systemctl daemon-reload: systemd turns each line into a mount unit, and keeps the old ones until then. - Network shares (nfs, cifs) wait for the network at boot; with
nofailandx-systemd.automount, a missing server doesn't block it. - Most systems already mount with
relatime, which updates access times at most once a day:noatimesaves little more.
Deep dive 2 questions
What do the two numbers at the end mean?
The fifth field was for dump, an old backup tool: use 0. The sixth sets
the order of filesystem checks at boot: 1 for the root filesystem, 2 for
the others, 0 to skip. btrfs and XFS check themselves, so they use 0.
Who reads fstab today?
On systemd systems, a generator turns every line into a .mount unit at
boot and at each daemon-reload. That's why systemd options work there:
x-systemd.automount mounts on first access, and
x-systemd.device-timeout=10s limits how long boot waits for a disk.