Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)
Image of RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)
Image of XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer)
Image of Modern Operating Systems (3rd Edition)

Systemd and /etc/fstab

Once again Lennart Poettering and Kay Sievers have managed to complicate things and broken the simple model that served the Unix and Linux communities well for over 30 years, i.e. that details of filesystem mounts that should persist across a reboot are listed in /etc/(v)fstab.

With systemd, mount units may either be configured via unit files, or via /etc/fstab. Mounts listed in /etc/fstab are converted into native units dynamically using systemd-fstab-generator at boot time or when the system manager configuration is reloaded. In general, configuring mount points through /etc/fstab is the preferred approach.

A systemd unit configuration file whose name ends in “.mount” encodes information about a file system mount point controlled and supervised by systemd. If a mount point is configured in a unit file in both /etc/fstab and a unit file that is stored below /usr, the former will take precedence. If the unit file is stored below /etc, it will take precedence. This means that native unit files take precedence over traditional configuration files, but this is superseded by the rule that configuration files in /etc always take precedence over configuration files in /usr.

Here is an example of the mount file for /tmp on Fedora 20:

$ cat /usr/lib/systemd/system/tmp.mount

#  This file is part of systemd.
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

Description=Temporary Directory


Here is an example of the output of systemd-fstab-generator for the /home/fpm line in /etc/fstab:

# grep FPMWORK /etc/fstab
LABEL=FPMWORK /home/fpm    ext4   defaults        0 3

# Automatically generated by systemd-fstab-generator



Now you have more work to do to understand where and how pseudo files and pseudo and regular filesystems are mounted. It is no longer enough to just look at /etc/fstab.

Comments are closed.