SYSTEMD.AUTOMOUNT(5)
โจ systemd.automount โ Automount unit configuration โจ
okay bestie, welcome to systemd.automount(5), the page that teaches you how to make mounts happen on demand like the main character you are ๐
๐ธ SYNOPSIS ๐ธ
automount.automount
๐ฆ DESCRIPTION ๐ฆ
So a unit configuration file whose name ends in .automount is literally a little info packet about a file system automount point that systemd controls and supervises. Automount units can do on-demand mounting, and also parallelized mounting of file systems. Both. Iconic.
This page is just the options that are special to this unit type. For the common options that every unit config file gets, go read systemd.unit(5). Those common bits live in the generic [Unit] and [Install] sections. The automount-specific stuff lives in the [Automount] section. That's the whole layout, no cap.
Automount units must be named after the automount directories they control. Example: the automount point /home/lennart has to be configured in a unit file named home-lennart.automount. Wanna know the escaping logic that turns a file system path into a unit name? systemd.unit(5), babes. Also note: automount units cannot be templated, and you can't add multiple names to one by making symlinks to its unit file either. Nope. Not happening. ๐
For every automount unit file, a matching mount unit file has to exist (peep systemd.mount(5) for the deets), and that mount unit gets activated when somebody accesses the automount path. Example: if the automount unit home-lennart.automount is active and the user accesses /home/lennart, then the mount unit home-lennart.mount will be activated. Slay, that's the whole trick. โจ
โ ๏ธ Note that automount units are separate from the mount itself, so do not setAfter=orRequires=for mount dependencies here. Like, do not setAfter=network-online.targetor anything similar on network filesystems. If you do, you might get an ordering cycle. Not cute. ๐
โ ๏ธ Also note: automount support on Linux is privileged, so automount units are only available in the system service manager (and root's user service manager) โ not in unprivileged users' service managers. Sorry bestie, that's just the rules.
โ ๏ธ And one more: automount units should not be nested. (Because setting up the inner automount point would unconditionally pin the outer mount point, which completely defeats its purpose. Rude.)
๐ AUTOMATIC DEPENDENCIES ๐
๐ซ Implicit Dependencies ๐ซ
These dependencies get added automatically, you don't even have to ask:
- If an automount unit is beneath another mount unit in the file system hierarchy, a requirement and ordering dependencies are created to the unit higher in the hierarchy. (Yes, hierarchy stuff. It's giving family tree. ๐ณ)
- An implicit
Before=dependency is created between an automount unit and the mount unit it activates.
๐ Default Dependencies ๐
These get added unless you set DefaultDependencies=no:
- Automount units acquire automatic
Before=andConflicts=onumount.targetso they get stopped during shutdown. Cleanup era. ๐งน - Automount units automatically gain an
After=dependency onlocal-fs-pre.target, and aBefore=dependency onlocal-fs.target.
๐ FSTAB ๐
Automount units can be configured either via unit files, or via /etc/fstab (see fstab(5) for details). Choose your fighter.
For the details on how systemd parses /etc/fstab, see systemd.mount(5).
If an automount point is configured in both /etc/fstab and a unit file, the configuration in the latter takes precedence. Unit file wins, periodt. ๐
โจ OPTIONS โจ
Automount unit files may include [Unit] and [Install] sections, which are described over in systemd.unit(5).
Automount unit files must include an [Automount] section, and that section carries all the info about the file system automount points it supervises. The options specific to the [Automount] section of automount units are these:
Where=โ Takes an absolute path of a directory of the automount point. If the automount point doesn't exist at the time the automount point is installed, it gets created. This string must be reflected in the unit filename. (See above, bestie.) This option is mandatory. No skipping it. ๐จExtraOptions=โ Extra mount options to use when creating the autofs mountpoint. Takes a comma-separated list of options. This setting is optional. Note that the usual specifier expansion is applied to this setting, so literal percent characters should hence be written as"%%". โจ Added in version 250.DirectoryMode=โ Directories of automount points (and any parent directories) are automatically created if needed. This option specifies the file system access mode used when creating these directories. Takes an access mode in octal notation. Defaults to0755.TimeoutIdleSec=โ Configures an idle timeout. Once the mount has been idle for the specified time, systemd will attempt to unmount. Takes a unit-less value in seconds, or a time span value such as"5min 20s". Pass0to disable the timeout logic. The timeout is disabled by default. ๐ Added in version 220.
Check systemd.unit(5), systemd.exec(5), and systemd.kill(5) for more settings. There's always more lore. ๐
๐ SEE ALSO ๐
systemd(1), systemctl(1), systemd.unit(5), systemd.mount(5), mount(8), automount(8), systemd.directives(7)
and that's the whole page, bestie, you ate that ๐ซถ this was systemd 262.1 โ go forth and automount responsibly, ily, bye ๐
๐ฆ where this page comes from
- arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms