Mounting Linux volumes with systemd vs fstab
What is better, mounting with
In this example, we are going to look at /dev/sda6 which is mounted to /apps using the XFS file partition and using the defaults. In the sample
The UUID you can get by running
I know that Red Hat is going to be using the systemd method of mounting in future versions of Red Hat, so it would be good to understand this way of doing it. In all it is not that much more difficult to setup as before, however the mounts will all be controlled via the systemd process and you can use commands such as systemctl status, start, enable, and disable on your individual mounts.
The first step is to get a sample .mount file that you can edit for your purposes. These files are located on your system at /lib/
# cp tmp.mount /etc/systemd/system/apps.mount
You want to pick a name that will be descriptive of what you are mounting. In this example we are mounting an apps volume, so that is why I chose the apps.mount filename.
We can then use vim to edit the file and change it to meet our requirements. We can remove any information related to the tmp.mount file, and add the proper information to have our apps volume mount. In the screenshot to the right, you see an example of what the file should look like. Under the [Mount] section we can enter the following:
As you can see the format is similar to what you have done in the
Benefits of using UUID
Also the use of UUID=”277927f6-a97a-4580-b409-eb9b6cb09fca” instead of /dev/sda6 is preferred to prevent issues if the device names change due to a file system reconfiguration later on. Remember, you can see what the UUID of any device is by running the
# systemctl daemon-reload # systemctl start apps.mount # systemctl status apps.mount # systemctl enable apps.mount
Don’t forget to add the .mount at the end, as if you forget
At this point, the volume will mount each time the system starts via
I hope you found this article informative. If you have any questions, feel free to reach out to me.