/etc/fstab line to mount a disk, an NFS or Windows (SMB) share, a swap file, a RAM disk or a bind mount at boot, with the safe steps to add it: back up, check with findmnt --verify, reload systemd, mount. Paste a line from blkid to fill in the UUID. Or paste your whole fstab to have every line explained and checked for mistakes that stop a server booting.| Field | Example | What it means |
|---|---|---|
| 1. Device | UUID=3e6b… | What to mount: a disk by its UUID or LABEL, a share like nas:/srv/share or //server/share, a swap file, or tmpfs. |
| 2. Mount point | /mnt/data | The folder where it appears. none for swap. A space is written \040. |
| 3. Type | ext4 | The filesystem: ext4, xfs, btrfs, vfat, exfat, ntfs3, nfs, cifs, swap, tmpfs, or none for a bind mount. |
| 4. Options | defaults,nofail | Comma-separated, no spaces. defaults when you need nothing special. |
| 5. Dump | 0 | Only for the old dump backup tool. Always 0 today. |
| 6. Pass | 2 | Check the filesystem at boot: 1 for /, 2 for other ext4 and vfat disks, 0 for everything else (xfs, btrfs, swap, shares). |
| Option | What it does |
|---|---|
nofail | Boot carries on if it’s missing. Use it for every disk and share the system doesn’t need to start. |
x-systemd.automount | Mount on first use, so boot never waits. Good for network shares and USB disks. |
noatime | Don’t write a timestamp every time a file is read. Fewer writes, slightly faster. |
ro | Read-only. |
noauto | Don’t mount at boot; mount it by hand with sudo mount /mnt/data. |
noexec, nosuid, nodev | Data only: no programs, setuid bits or device files. Good for shared and removable storage. |
uid=, gid=, umask= | Owner and permissions for vfat, exFAT, NTFS and SMB, which don’t store Linux owners. ext4 and xfs refuse them. |
credentials= | SMB: a root-only file holding the user name and password, so they stay out of fstab. |
_netdev | Needs the network. systemd already knows that for NFS and SMB; it matters for disks reached over iSCSI. |
errors=remount-ro | ext4: switch to read-only if the filesystem finds an error. Debian and Ubuntu use it for /. |
subvol=, compress=zstd | btrfs: which subvolume to mount, and compress new files. |
discard | Tell an SSD about deleted blocks at once. Most distributions run fstrim weekly instead, which is usually better. |
sudo findmnt --verify to catch mistakes, then sudo systemctl daemon-reload. Without the reload, mount warns that systemd “still uses the old version”.sudo mount -a mounts everything in fstab that isn’t mounted yet. It’s a good test before you reboot.UUID= for disks. Names like /dev/sdb1 can swap around when disks are added or a USB stick is plugged in. A UUID changes only when you reformat.sudo blkid or lsblk -f.\040: /mnt/My\040Disk.nofail to anything the system doesn’t need to boot. Without it, a missing disk stops the boot in emergency mode.chmod 600).init=/bin/bash to the end of the line that starts with linux, and press Ctrl+X.)mount -o remount,rw /cp /etc/fstab.bak-… /etc/fstab, or open nano /etc/fstab and put a # in front of the bad line.reboot (after init=/bin/bash, use sync then reboot -f).Paste a line from sudo blkid or fill in the share details, and the builder writes the fstab line with the right options, then the steps to add it safely: back up the file, check it with findmnt --verify, tell systemd, and mount. The checker explains every line of an existing fstab and flags the mistakes that stop a server booting.
Find the partition’s UUID with sudo blkid, make a folder with sudo mkdir -p /mnt/data, and add a line like UUID=… /mnt/data ext4 defaults,nofail 0 2 to /etc/fstab. Then run sudo findmnt --verify, sudo systemctl daemon-reload and sudo mount -a to test it before you reboot.
The fifth field is for the old dump backup tool and is always 0 today. The sixth decides the boot-time filesystem check: 1 for the root filesystem, 2 for other ext4 and FAT disks, and 0 for no check, which is right for xfs, btrfs, swap and network shares.
It lets the boot carry on if that disk or share is missing. Without it, systemd stops in emergency mode when a local disk listed in fstab isn’t there, and for a network share, logins wait until the mount times out. Use it for everything the system doesn’t need to start.
Enter the root password at the prompt, run mount -o remount,rw /, then restore your backup of /etc/fstab or put a # in front of the bad line, and reboot. If root has no password, add init=/bin/bash to the kernel line in the GRUB menu to get a shell.
Every user can read /etc/fstab, so put the user name and password in a separate file that only root can read (chmod 600), and point to it with credentials=/root/.smbcredentials. Install cifs-utils first, and add nofail so a missing server doesn’t hold up the boot.
Related tools: Systemd Generator · Error Message Decoder · All tools A–Z
Most tools run entirely in your browser. Tools marked 📡 contact outside services, as listed in the Privacy Policy. Review commands before you run them; see the Terms.