systemd can manage a local filesystem through a native .mount unit without adding a line to /etc/fstab. The same unit layout, systemctl commands, and boot integration apply on RHEL 8 through 10, Rocky Linux, AlmaLinux, CentOS Stream, and Oracle Linux.
This guide covers a normal local filesystem that mounts during boot. On-demand .automount units, network filesystems, and custom mount ordering are separate topics.
Tested on: Rocky Linux 10.2 (Red Quartz); systemd 257; XFS on
/dev/sdb1; mount point/mnt/data.
systemd mount unit compatibility
| Distribution | Versions covered | Unit directory | Procedure |
|---|---|---|---|
| RHEL | 8, 9, 10 | /etc/systemd/system |
Same native .mount unit |
| Rocky Linux | 8, 9, 10 | /etc/systemd/system |
Same native .mount unit |
| AlmaLinux | 8, 9, 10 | /etc/systemd/system |
Same native .mount unit |
| CentOS Stream | 9, 10 | /etc/systemd/system |
Same native .mount unit |
| Oracle Linux | 8, 9, 10 | /etc/systemd/system |
Same native .mount unit |
No distribution-specific repository or package installation is normally required. systemd and the standard mount utilities ship with the base operating system.
systemd mount unit vs /etc/fstab
/etc/fstab remains the usual human-managed interface for persistent local mounts. systemd-fstab-generator converts fstab entries into generated mount units under /run/systemd/generator/ and related generator directories during manager startup and reload.
Native .mount files are useful when configuration-management tools need a complete unit file or when you require explicit unit dependencies. They are not universally better than /etc/fstab for every local disk.
After the system boots, you can inspect fstab-generated units under the runtime generator directory:
ls -l /run/systemd/generator/Sample output:
boot.mount
-.mount
local-fs.target.wants| Directory | Purpose |
|---|---|
/usr/lib/systemd/system |
Vendor units installed by RPM packages |
/run/systemd/system |
Runtime unit files, overrides, masks, and transient configuration |
/run/systemd/generator/, /run/systemd/generator.early/, /run/systemd/generator.late/ |
Units dynamically created by generators, including units derived from /etc/fstab |
/etc/systemd/system |
Administrator-created and customized units |
Custom mount units in this guide belong in /etc/systemd/system, which takes precedence over vendor and normal runtime unit paths.
Check the filesystem and mount point
This walkthrough uses one example throughout:
| Item | Value |
|---|---|
| Device | /dev/sdb1 |
| Filesystem | XFS |
| Mount point | /mnt/data |
| Unit name | mnt-data.mount |
Inspect the block device and its filesystem metadata:
lsblk --fs /dev/sdb1Sample output:
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sdb1 xfs 9ed883cb-de4f-4cd3-865b-b9e7d51d9a6fRead the UUID and filesystem type you will reference in the unit file:
blkid /dev/sdb1Sample output:
/dev/sdb1: UUID="9ed883cb-de4f-4cd3-865b-b9e7d51d9a6f" BLOCK_SIZE="512" TYPE="xfs" PARTLABEL="primary"Confirm the target path is not already mounted:
findmnt /mnt/dataWhen nothing is mounted there, findmnt prints no target line and exits with a non-zero status.
Create the mount-point directory explicitly so you can verify the path and its parent-directory permissions before starting the unit:
mkdir -p /mnt/dataAfter mounting the filesystem, apply the required owner, group, permissions, and SELinux labeling to the mounted filesystem itself. The metadata of the underlying empty mount-point directory is hidden while the filesystem is mounted.
/dev/sdb1 already contains a filesystem. If you are preparing a new lab disk, remember that running mkfs.xfs or mkfs.ext4 destroys any existing data on the selected partition.
Generate the correct systemd mount unit name
The .mount filename must be derived from the exact Where= path. Generate it instead of guessing:
systemd-escape --path --suffix=mount /mnt/dataSample output:
mnt-data.mount| Mount point | Unit name |
|---|---|
/mnt/data |
mnt-data.mount |
/srv/app/data |
srv-app-data.mount |
/mnt/data-backup |
mnt-data\x2dbackup.mount |
Use systemd-escape even when a filename appears obvious. Underscores are preserved, but literal hyphens, spaces, and other special characters require escaping.
For example:
systemd-escape --path --suffix=mount /mnt/data-backupSample output:
mnt-data\x2dbackup.mountThe underscore path /tmp_dir correctly maps to tmp_dir.mount, while /mnt/data-backup does not map to the manually guessed name mnt-data-backup.mount.
Create the systemd mount unit
Create the administrator-managed unit in /etc/systemd/system:
vi /etc/systemd/system/mnt-data.mountUse a minimal local-filesystem unit. Replace the UUID path with the value from blkid:
[Unit]
Description=Mount data filesystem on /mnt/data
[Mount]
What=/dev/disk/by-uuid/9ed883cb-de4f-4cd3-865b-b9e7d51d9a6f
Where=/mnt/data
Type=xfs
Options=defaults
[Install]
WantedBy=local-fs.targetDescription= is the human-readable label in systemctl status. What= identifies the source filesystem. A persistent path under /dev/disk/by-uuid/ is preferred over a changing device name such as /dev/sdb1. Where= must match the path encoded in the filename. Type= names the filesystem (xfs, ext4, and so on). Options= lists comma-separated mount options. WantedBy=local-fs.target ties the mount into the boot-time local-filesystem stage when the unit is enabled.
Do not add DefaultDependencies=no, Conflicts=umount.target, Before=local-fs.target, or After=swap.target to an ordinary local mount. systemd inserts the normal device, shutdown, and local-filesystem dependencies automatically. Change ordering only when you have a demonstrated special requirement.
Validate and start the mount unit
Reload systemd after creating or editing the unit:
systemctl daemon-reloadValidate the file before starting it:
systemd-analyze verify /etc/systemd/system/mnt-data.mountA valid unit exits silently. Mount and service management in the steps below use the systemctl command.
Start the mount:
systemctl start mnt-data.mountCheck unit state:
systemctl status mnt-data.mountSample output:
● mnt-data.mount - Mount data filesystem on /mnt/data
Loaded: loaded (/etc/systemd/system/mnt-data.mount; disabled; preset: disabled)
Active: active (mounted)
Where: /mnt/data
What: /dev/sdb1Starting the unit mounts the filesystem for the current session. Enablement for future boots comes in the next section.
Verify the kernel mount table:
findmnt /mnt/dataSample output:
TARGET SOURCE FSTYPE OPTIONS
/mnt/data /dev/sdb1 xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquotaFor source, target, filesystem, and options in one line:
findmnt --output SOURCE,TARGET,FSTYPE,OPTIONS /mnt/datafindmnt is more precise for mount verification than pasting full df -h output.
Enable the filesystem mount at boot
Enable the unit and mount it in one step:
systemctl enable --now mnt-data.mountAfter enablement, systemctl status mnt-data.mount shows enabled in the Loaded line.
Confirm enablement:
systemctl is-enabled mnt-data.mountSample output:
enabledCheck that the unit is wired into the local filesystem target:
systemctl list-dependencies local-fs.target | grep mnt-dataSample output:
● ├─mnt-data.mountAfter the next reboot, confirm the mount is still active:
systemctl status mnt-data.mountfindmnt /mnt/dataBoth commands should show the same source device and mount point as before the reboot.
Stop, disable, or remove the mount unit
Stop and unmount the filesystem:
systemctl stop mnt-data.mountDisable boot-time activation:
systemctl disable mnt-data.mountOr combine stop and disable:
systemctl disable --now mnt-data.mountRemove the unit file and refresh systemd:
rm -f /etc/systemd/system/mnt-data.mountsystemctl daemon-reloadConfirm the path is no longer mounted:
findmnt /mnt/dataRemoving the unit does not delete or format the underlying filesystem.
Troubleshoot systemd mount unit errors
Unit name does not match Where
Regenerate the expected name:
systemd-escape --path --suffix=mount /mnt/data/mnt/data requires mnt-data.mount. A mismatched filename produces errors such as “Where setting does not match unit name”.
Dependency failed or device timed out
Inspect the device and unit logs:
lsblk --fsblkidsystemctl status mnt-data.mountjournalctl -u mnt-data.mount -bCommon causes include an incorrect UUID, a missing disk, an inactive LVM volume, the wrong filesystem type, filesystem damage, or a device that appears too late during boot.
Mount point is already mounted
Check for an existing mount:
findmnt /mnt/dataRemove a conflicting /etc/fstab entry or another native mount unit. Do not define the same mount in two places.
Target is busy during unmount
See which processes use the mount:
fuser -vm /mnt/dataIf the command is unavailable on a minimal installation, install the package that provides it:
dnf install psmiscStop those processes, then retry:
systemctl stop mnt-data.mountDo not reach for force or lazy unmount as the first fix.
Unit works manually but not after reboot
Check enablement and boot logs:
systemctl is-enabled mnt-data.mountsystemctl list-dependencies local-fs.targetjournalctl -b -u mnt-data.mountConfirm the unit has an [Install] section and was enabled with systemctl enable.
| Symptom | Likely cause | Fix |
|---|---|---|
| Where does not match unit name | Wrong filename | systemd-escape --path --suffix=mount |
| Dependency failed / timeout | Wrong UUID, missing disk, late device | blkid, journalctl -u mnt-data.mount -b |
| Already mounted | Duplicate fstab or unit | Remove the duplicate definition |
| Target busy on stop | Open files or processes | fuser -vm, stop services first |
| Missing after reboot | Unit not enabled | Add [Install] and systemctl enable |
When to use mount, automount, or fstab
| Requirement | Recommended method |
|---|---|
| Simple persistent local mount | /etc/fstab |
| Complete native unit managed by automation | .mount unit |
| Mount only when accessed | .mount plus .automount |
| Network share | /etc/fstab or native network mount with network-aware dependencies |
| Explicit ordering between filesystems or services | Native systemd dependencies |
For mount-on-access behavior, see automount a partition with systemd. For sequencing mounts relative to services or other filesystems, see mount filesystems in a specific order with systemd. For a one-off interactive mount that does not persist across reboot, see the mount command.
Conclusion
Match the .mount unit filename to the mount path with systemd-escape --path --suffix=mount. Place custom units in /etc/systemd/system, reference stable UUID paths under /dev/disk/by-uuid/ in What=, and keep systemd's automatic dependencies on ordinary local mounts. systemctl enable --now makes the native mount persistent across reboot when an [Install] section points at local-fs.target.

