summaryrefslogtreecommitdiffstats
path: root/man/systemd.automount.xml
blob: a6bc81e216b50f292ee8cf7ffc3fef787caacfa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?xml version='1.0'?> <!--*-nxml-*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->

<refentry id="systemd.automount">
  <refentryinfo>
    <title>systemd.automount</title>
    <productname>systemd</productname>
  </refentryinfo>

  <refmeta>
    <refentrytitle>systemd.automount</refentrytitle>
    <manvolnum>5</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>systemd.automount</refname>
    <refpurpose>Automount unit configuration</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <para><filename><replaceable>automount</replaceable>.automount</filename></para>
  </refsynopsisdiv>

  <refsect1>
    <title>Description</title>

    <para>A unit configuration file whose name ends in
    <literal>.automount</literal> encodes information about a file
    system automount point controlled and supervised by
    systemd.</para>

    <para>This man page lists the configuration options specific to
    this unit type. See
    <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
    for the common options of all unit configuration files. The common
    configuration items are configured in the generic [Unit] and
    [Install] sections. The automount specific configuration options
    are configured in the [Automount] section.</para>

    <para>Automount units must be named after the automount directories they control. Example: the automount point
    <filename index="false">/home/lennart</filename> must be configured in a unit file
    <filename>home-lennart.automount</filename>. For details about the escaping logic used to convert a file system
    path to a unit name see
    <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Note that
    automount units cannot be templated, nor is it possible to add multiple names to an automount unit by creating
    additional symlinks to its unit file.</para>

    <para>For each automount unit file a matching mount unit file (see
    <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
    for details) must exist which is activated when the automount path
    is accessed. Example: if an automount unit
    <filename>home-lennart.automount</filename> is active and the user
    accesses <filename>/home/lennart</filename> the mount unit
    <filename>home-lennart.mount</filename> will be activated.</para>

    <para>Automount units may be used to implement on-demand mounting
    as well as parallelized mounting of file systems.</para>

    <para>Note that automount units are separate from the mount itself, so you
    should not set <varname>After=</varname> or <varname>Requires=</varname>
    for mount dependencies here. For example, you should not set
    <varname>After=network-online.target</varname> or similar on network
    filesystems. Doing so may result in an ordering cycle.</para>

    <para>Note that automount support on Linux is privileged, automount units are hence only available in the
    system service manager (and root's user service manager), but not in unprivileged user's service
    manager.</para>
  </refsect1>

  <refsect1>
    <title>Automatic Dependencies</title>

    <refsect2>
      <title>Implicit Dependencies</title>

      <para>The following dependencies are implicitly added:</para>

      <itemizedlist>
        <listitem><para>If an automount unit is beneath another mount unit in the
        file system hierarchy, both a requirement and an ordering
        dependency between both units are created automatically.</para></listitem>

        <listitem><para>An implicit <varname>Before=</varname> dependency is created
        between an automount unit and the mount unit it activates.</para></listitem>
      </itemizedlist>
    </refsect2>

    <refsect2>
      <title>Default Dependencies</title>

      <para>The following dependencies are added unless <varname>DefaultDependencies=no</varname> is set:</para>

      <itemizedlist>
        <listitem><para>Automount units acquire automatic <varname>Before=</varname> and
        <varname>Conflicts=</varname> on <filename>umount.target</filename> in order to be stopped during
        shutdown.</para></listitem>

        <listitem><para>Automount units automatically gain an <varname>After=</varname> dependency
        on <filename>local-fs-pre.target</filename>, and a <varname>Before=</varname> dependency on
        <filename>local-fs.target</filename>.</para></listitem>
      </itemizedlist>
    </refsect2>
  </refsect1>

  <refsect1>
    <title><filename>fstab</filename></title>

    <para>Automount units may either be configured via unit files, or
    via <filename>/etc/fstab</filename> (see
    <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
    for details).</para>

    <para>For details how systemd parses
    <filename>/etc/fstab</filename> see
    <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>

    <para>If an automount point is configured in both
    <filename>/etc/fstab</filename> and a unit file, the configuration
    in the latter takes precedence.</para>
  </refsect1>

  <refsect1>
    <title>Options</title>

    <para>Automount files must include an [Automount] section, which
    carries information about the file system automount points it
    supervises. The options specific to the [Automount] section of
    automount units are the following:</para>

    <variablelist class='unit-directives'>

      <varlistentry>
        <term><varname>Where=</varname></term>
        <listitem><para>Takes an absolute path of a directory of the
        automount point. If the automount point does not exist at time
        that the automount point is installed, it is created. This
        string must be reflected in the unit filename. (See above.)
        This option is mandatory.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><varname>DirectoryMode=</varname></term>
        <listitem><para>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 to 0755.</para></listitem>
      </varlistentry>
      <varlistentry>
        <term><varname>TimeoutIdleSec=</varname></term>
        <listitem><para>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".
        Pass 0 to disable the timeout logic. The timeout is disabled by
        default.</para></listitem>
      </varlistentry>
    </variablelist>
  </refsect1>

  <refsect1>
      <title>See Also</title>
      <para>
        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
        <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
        <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
        <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
        <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
        <citerefentry project='die-net'><refentrytitle>automount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
        <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
      </para>
  </refsect1>

</refentry>