fstab That Survives a Reboot and Doesn't Brick the Boot
The options and identifiers that keep a bad mount entry from stalling the entire machine

Contents
I once added a line to /etc/fstab for a USB drive I was about to plug in permanently, using /dev/sdb1 because that’s what lsblk showed at the time. Weeks later a firmware update changed enumeration order, that drive became /dev/sdc1, and the box sat at an emergency shell on every boot until I plugged in a monitor to find out why. The fstab file is one of the few places in Linux where a single wrong line can genuinely stop a headless machine from booting at all — worth understanding properly before you edit it casually.
Why device names are the wrong identifier
/dev/sdX naming is assigned at boot, in enumeration order, by whatever the kernel happens to detect first. That order isn’t guaranteed stable across reboots, especially with USB devices, hot-swap bays, or after adding/removing any storage device — the drive that was sdb can become sdc for reasons that have nothing to do with the drive itself. fstab entries keyed on /dev/sdX work until the day they don’t, silently, and the failure mode when they break is the worst kind: the boot process hangs waiting for a device that the kernel simply renamed, still physically present the whole time.

Use a UUID instead — an identifier baked into the filesystem itself at creation time, which follows the filesystem regardless of what bus, port or enumeration order it shows up under:
| |
Or LABEL= if you set filesystem labels deliberately, which I actually prefer for anything I manage by hand since it’s human-readable in the fstab file itself rather than an opaque hex string:
| |
Either is stable across reboots and enumeration changes. /dev/sdX should only ever appear in fstab as a debugging convenience you replace before saving the file, never as the entry you actually leave running.
Anatomy of an fstab line
| |
Six fields, each meaningful:
- Device — UUID or LABEL, per above.
- Mount point — must already exist as a directory (
mkdir -p /mnt/backupfirst) or the mount fails. - Filesystem type —
ext4,xfs,nfs,cifs,auto(let the kernel detect it, fine for removable media, worth being explicit for anything permanent). - Options, comma-separated, no spaces — covered below in detail.
- Dump — legacy
dumpbackup utility flag, essentially unused today;0is correct on virtually every modern system. - Pass — fsck order at boot.
0skips fsck entirely,1for the root filesystem specifically,2for everything else that should be checked. Non-root filesystems should never be1.
The options that actually matter
nofail is the single most important option on this list for anything that isn’t the root filesystem, and it’s the one people learn about only after their first fstab-caused boot hang. Without it, if the device fails to mount — unplugged drive, network share unreachable, a typo in the UUID — systemd’s generated mount unit blocks the boot sequence waiting for it, and a headless machine sits there until something (a timeout, eventually, or your manual intervention at a console) breaks the deadlock. nofail tells systemd this mount is not required for the system to consider itself booted; if it fails, boot continues and the mount is simply absent, which is a state you can diagnose and fix over SSH rather than one that locks you out of SSH in the first place.
| |
noatime stops the filesystem from updating the last-accessed timestamp on every single file read, which is pure overhead for the vast majority of workloads — nothing on a homelab box is actually consuming atime data. Worth adding by default unless you specifically know something reads it (some mail servers and a handful of backup tools do; check before blanket-applying across a box you didn’t build yourself).
x-systemd.automount defers the actual mount until the mount point is first accessed, rather than at boot — genuinely useful for network shares or removable media where you’d rather boot fast and mount lazily than wait on something that might not be there yet:
| |
x-systemd.mount-timeout= caps how long systemd waits before giving up on a specific mount, independent of nofail — the two work together well: nofail prevents a hang from blocking the whole boot, while mount-timeout prevents that individual mount attempt from hanging indefinitely in the background.
| Option | What it does | Typical use |
|---|---|---|
nofail | Boot continues if the mount fails | Every non-root mount |
noauto | Skips the mount at boot | Occasional drives |
x-systemd.automount | Mounts on first access | Network shares, removable media |
x-systemd.mount-timeout= | Caps the wait for one mount | Slow or remote mounts |
_netdev | Orders the mount after the network | NFS and CIFS |
noatime | Skips access-time updates | Most data volumes |
Network filesystems need extra care
NFS and CIFS/SMB mounts in fstab are the most common source of the boot-hang I opened with, because they depend on the network being up and the remote host being reachable — two things that aren’t guaranteed at the exact moment fstab-driven mounts are normally processed during boot.
| |
_netdev marks the mount as depending on network availability, which tells systemd to sequence it after networking comes up rather than treating it like local storage. x-systemd.requires=network-online.target makes that dependency explicit rather than implied. Both nofail and x-systemd.automount remain worth combining here — a NAS that’s rebooting when your server boots shouldn’t be able to stall your server’s boot in return.
For CIFS/SMB specifically, credentials belong in a separate, permission-restricted file, never inline in fstab where any local user with read access to the file can see them:
| |
| |
Testing before you reboot
Never trust an fstab edit until you’ve validated it live — mount -a reads the file and attempts to mount everything not already mounted, without requiring an actual reboot to find out if the syntax is broken:
| |
That error immediately tells you the entry has a problem, while you still have a working shell to fix it — vastly preferable to discovering the same error via a dead SSH session after a reboot. findmnt --verify goes further and checks the whole file for structural and logical problems (duplicate mount points, missing directories, unknown options) without attempting to actually mount anything:
| |
I run both before every fstab edit, in that order — findmnt --verify for the structural check, then mount -a to actually attempt the mounts and confirm the whole set applies cleanly.
fstab and systemd: it’s generated units underneath
Modern systemd-based distros don’t process fstab with a separate legacy mount script — systemd-fstab-generator reads it at boot and creates a .mount unit for every entry, which then participates in the same dependency graph as every other unit. This is worth knowing because it means fstab problems are debuggable with the exact same tools as any other systemd unit failure — no separate mechanism to learn:
| |
The mount point path gets translated into the unit name by replacing / with -, so /mnt/backup becomes mnt-backup.mount. journalctl -u mnt-backup.mount gives the actual mount failure reason in the same format covered in a systemd service won’t start — the fstab file is really just a friendlier syntax for defining systemd mount units, and every diagnostic habit that applies to a .service unit applies here too.
One consequence: after editing fstab, a systemctl daemon-reload regenerates these units from the new file. mount -a alone works for actually mounting things, but if you want systemd’s own view of the unit (its dependency ordering, its Before=/After=) to reflect a structural change you just made — adding x-systemd.automount, for instance — reload first:
| |
Bind mounts: the fstab entry people forget exists
A bind mount makes a directory accessible at a second path without duplicating the data — genuinely useful for exposing part of one filesystem tree inside a container’s bind-mounted volume, or for restructuring paths without physically moving files. fstab supports these directly, and they’re worth knowing because the syntax looks unusual the first time:
| |
The filesystem type field is none (there isn’t one — it’s not a new filesystem, just a second mount point for an existing directory tree) and the options field carries bind instead of a normal mount option. nofail still applies and still matters: if the source directory doesn’t exist yet (a not-yet-mounted external drive that /srv/media itself lives on, say), you want the same graceful boot-continues behaviour as any other entry, since a convenience mount like this one isn’t worth stalling a boot over.
noauto: mounting on demand instead of at boot
nofail and noauto solve related but distinct problems, and conflating
them is a common mistake. nofail lets boot continue if a mount fails;
noauto skips attempting the mount at boot at all, leaving it to be
triggered manually or by x-systemd.automount:
| |
For an external drive that’s only plugged in occasionally, noauto alone
means mount -a at boot won’t even try it, and mount /mnt/archive works
whenever the drive happens to be connected. Pairing it with
x-systemd.automount gets the best of both — nothing attempted at boot,
but the first ls /mnt/archive (or any access to that path) triggers the
mount transparently, without needing a manual mount command remembered
after plugging the drive back in. Without x-systemd.automount, noauto
alone means the mount point simply sits empty until someone runs mount
by hand, which is the right choice for something genuinely occasional
(an offline backup drive brought out once a month) versus the automount
combination, which suits something that should feel present whenever it’s
physically connected.
A worked example: adding a second drive without a reboot
The full sequence, in order, for a drive that’s already physically connected and partitioned — the same steps whether it’s a new NAS addition or a drive migrated in from another box:
| |
Each step is individually cheap to check before moving to the next —
findmnt --verify catches a typo’d UUID or a missing mount point before
mount -a ever tries to act on it, and the final mount | grep confirms
the entry actually took effect rather than trusting that a clean exit
code from mount -a means everything mounted the way it was intended to.
The whole sequence takes under a minute and never touches a running
service or requires a reboot — the only time a reboot is genuinely worth
doing afterward is to confirm the fstab entry survives one cleanly, which
is worth doing once on a new entry rather than assuming mount -a
succeeding today guarantees the same result after the next restart.
Troubleshooting
Boot hangs at “a start job is running for /mnt/whatever”. Missing nofail on a mount that can’t currently succeed. Boot into recovery/single-user mode (or wait out the timeout, usually 90 seconds by default), add nofail, and mount -a to confirm the fix without needing another reboot.
Mount succeeds manually but not at boot. Frequently a network-dependency ordering issue — the mount was attempted before the network (or the specific interface, or DNS) was actually ready. Add _netdev and x-systemd.requires=network-online.target for anything remote.
UUID= entry stopped working after reformatting the drive. Reformatting generates a new UUID — the old fstab entry now points at nothing. Re-run blkid and update the entry; this is the single most common “why did my mount disappear” cause after any disk maintenance.
Duplicate mount point defined twice. findmnt --verify catches this, but if you’re debugging manually: systemd builds one mount unit per mount point, so a second entry for the same path is unsupported and can fail the mount (or even drop the boot to emergency mode), while a plain mount -a processes both lines and stacks the later mount over the earlier — check for a leftover entry from an earlier edit before assuming systemd is doing something strange.
Mount works over SSH but a service that depends on it fails at boot anyway. A service unit that reads from a mount point needs an explicit RequiresMountsFor= dependency in its own unit file, or systemd has no guarantee it started the service after the mount was ready — nofail deliberately decouples the mount from boot success, which means nothing automatically blocks a dependent service from starting too early unless that dependency is spelled out.
Related
If the entry you’re adding is a resized LVM volume, resizing an LVM volume covers making sure the UUID and mount options still match after a structural change to the underlying block device — a resize doesn’t usually change the UUID, but it’s worth confirming rather than assuming. If the mount is swap rather than a data filesystem, swap, swappiness and zram covers whether a disk-backed swap fstab entry is even the right call versus RAM-backed zram. And if a systemd-generated mount unit itself is the thing failing to start rather than the fstab syntax, a systemd service won’t start covers the same systemctl status/journalctl diagnostic method applied to .mount units specifically.
Verdict
Three habits prevent nearly every fstab-caused boot problem I’ve hit or seen reported: identify devices by UUID or LABEL rather than /dev/sdX, add nofail to anything that isn’t the root filesystem, and run mount -a before rebooting rather than after. None of that is exotic knowledge — it’s just the difference between an edit that’s been validated and one that’s been assumed correct.




