Technical Tip


How can I create a systemd mount unit in Oracle/RedHat/CentOS Enterprise Linux 7?

Although you can still place entries in /etc/fstab, file system mounts can be created using
a systemd mount unit, as follows.

This example mounts /dev/sdb1, containing an XFS file system, on /oradata.
# cd  /etc/systemd/system
# vi  oradata.mount
Insert the following lines in oradata.mount:-

Description = Mount for Oracle DB files
What = /dev/sdb1
Where = /oradata
Type = xfs
Options = uqnoenforce
WantedBy =

The mount unit name must be the same as the Where value, e.g. if you are mounting on /oradata,
then the mount unit name must be oradata.mount. See below for more complex mount points.

The What value can be a UUID, but use the full path as found in /dev/disk/by-uuid, not the /etc/fstab format.

We now have to run:-
# systemctl  daemon-reload
# systemctl  enable  oradata.mount
# systemctl  start  oradata.mount
# systemctl  status oradata.mount
● oradata.mount - Mount for Oracle DB
  Loaded: loaded (/etc/systemd/system/oradata.mount; enabled; vendor preset: disabled)
   Active: active (mounted) since Wed 2016-06-01 11:05:45 BST; 20s ago
    Where: /oradata
     What: /dev/sdb1
  Process: 31073 ExecMount=/bin/mount /dev/sdb1 /oradata -n -t xfs -o uqnoenforce (code=exited, status=0/SUCCESS)
   Memory: 0B

Jun 01 11:05:45 buzz systemd[1]: Mounting Mount for Oracle DB...
Jun 01 11:05:45 buzz systemd[1]: Mounted Mount for Oracle DB.

Note that the uqnoenforce option turns on disk quotas, but does not enforce any limits.
It is used this way for reporting purposes.

Finally, if you wish to have a mount point /export/home/joe, then the mount unit must be called export-home-joe.mount.

We hope this has been useful, see below for additional notes
Mick Hosegood - First Alternative. 2017.


  • All this is covered on the Enterprise Linux 7 administration courses!

First Alternative course tutors can answer questions like this ... and are happy to do so. Look around our site for relevant courses in Linux -Unix - Solaris

close window