Skip to content

How to Control the Mount Order of fstab Entries With systemd

Updated 3 min read

Updated: 28 September 2026 · Applies to: systemd 252 to 259 on AlmaLinux and Rocky Linux 9 and 10, RHEL 9 and 10, Ubuntu 24.04 and 26.04, Debian 13

On systems with systemd, the order of lines in /etc/fstab does not decide the order in which file systems are mounted. At boot, systemd turns every line into a mount unit and mounts them in parallel where it can. Most of the time it gets the order right on its own. When one mount needs another one first, tell systemd with mount options in /etc/fstab. We checked the options below with systemd's fstab generator on AlmaLinux 9 (systemd 252).

What systemd already orders for you

  • Nested mount points: a mount below another one, such as /data/mysql below /data, always waits for its parent. You do not need to do anything.
  • Network file systems such as NFS and CIFS wait for the network, because systemd recognises their type.
  • Devices: each mount waits for its disk to appear.

Options for everything else

  • x-systemd.requires-mounts-for=/path: mount this only after the file system that contains /path is mounted. Use it when a mount is not below the path it needs, for example a bind mount from another disk.
  • x-systemd.after=unit (or x-systemd.before=): order against any unit, for example another mount (srv-backup.mount) or a service. Find the unit name of a mount point with systemd-escape -p --suffix=mount /srv/backup.
  • _netdev: treat the mount as a network mount, so it waits for the network. Use it for file systems on network block devices, such as iSCSI, and for local mounts that depend on a network share.
  • nofail: if the mount fails, continue booting instead of stopping in emergency mode. Useful for data disks that are not needed to start the system.

Example

/dev/vdb1                /data          xfs   defaults  0 0
/dev/vdc1                /data/mysql    xfs   defaults  0 0
nfs.example.com:/export  /mnt/nfs       nfs   defaults,_netdev  0 0
/mnt/nfs/www             /var/www       none  bind,x-systemd.requires-mounts-for=/mnt/nfs,_netdev  0 0
/dev/vde1                /opt/app       xfs   defaults,x-systemd.after=data.mount,nofail  0 0

/data/mysql follows /data automatically. The bind mount of /var/www waits for the NFS share and, because of _netdev, is mounted with the network file systems rather than too early. /opt/app waits for /data and does not stop the boot if its disk is missing. In practice, prefer UUID= to device names.

Apply and check

systemctl daemon-reload
mount -a
systemctl show -p After -p RequiresMountsFor var-www.mount

daemon-reload regenerates the mount units from /etc/fstab; mount -a mounts anything new and reports mistakes before the next reboot. After a reboot, systemd-analyze critical-chain var-www.mount shows what the mount waited for.

Official documentation: systemd.mount manual and fstab(5) manual.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Linux server management

hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.

Was this answer helpful?

Still stuck? Open a ticket