]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.mount.xml
automount: add expire support
[thirdparty/systemd.git] / man / systemd.mount.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 This file is part of systemd.
7
8 Copyright 2010 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="systemd.mount">
25 <refentryinfo>
26 <title>systemd.mount</title>
27 <productname>systemd</productname>
28
29 <authorgroup>
30 <author>
31 <contrib>Developer</contrib>
32 <firstname>Lennart</firstname>
33 <surname>Poettering</surname>
34 <email>lennart@poettering.net</email>
35 </author>
36 </authorgroup>
37 </refentryinfo>
38
39 <refmeta>
40 <refentrytitle>systemd.mount</refentrytitle>
41 <manvolnum>5</manvolnum>
42 </refmeta>
43
44 <refnamediv>
45 <refname>systemd.mount</refname>
46 <refpurpose>Mount unit configuration</refpurpose>
47 </refnamediv>
48
49 <refsynopsisdiv>
50 <para><filename><replaceable>mount</replaceable>.mount</filename></para>
51 </refsynopsisdiv>
52
53 <refsect1>
54 <title>Description</title>
55
56 <para>A unit configuration file whose name ends in
57 <literal>.mount</literal> encodes information about a file system
58 mount point controlled and supervised by systemd.</para>
59
60 <para>This man page lists the configuration options specific to
61 this unit type. See
62 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
63 for the common options of all unit configuration files. The common
64 configuration items are configured in the generic [Unit] and
65 [Install] sections. The mount specific configuration options are
66 configured in the [Mount] section.</para>
67
68 <para>Additional options are listed in
69 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
70 which define the execution environment the
71 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
72 binary is executed in, and in
73 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
74 which define the way the processes are terminated, and in
75 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
76 which configure resource control settings for the processes of the
77 service. Note that the User= and Group= options are not
78 particularly useful for mount units specifying a
79 <literal>Type=</literal> option or using configuration not
80 specified in <filename>/etc/fstab</filename>;
81 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
82 will refuse options that are not listed in
83 <filename>/etc/fstab</filename> if it is not run as UID 0.</para>
84
85 <para>Mount units must be named after the mount point directories
86 they control. Example: the mount point
87 <filename noindex='true'>/home/lennart</filename> must be
88 configured in a unit file <filename>home-lennart.mount</filename>.
89 For details about the escaping logic used to convert a file system
90 path to a unit name, see
91 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
92
93 <para>Optionally, a mount unit may be accompanied by an automount
94 unit, to allow on-demand or parallelized mounting. See
95 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
96
97 <para>If a mount point is beneath another mount point in the file
98 system hierarchy, a dependency between both units is created
99 automatically.</para>
100
101 <para>Mount points created at runtime (independently of unit files
102 or <filename>/etc/fstab</filename>) will be monitored by systemd
103 and appear like any other mount unit in systemd. See
104 <filename>/proc/self/mountinfo</filename> description in
105 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
106 </para>
107
108 <para>Some file systems have special semantics as API file systems
109 for kernel-to-userspace and userspace-to-userpace interfaces. Some
110 of them may not be changed via mount units, and cannot be
111 disabled. For a longer discussion see <ulink
112 url="http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems">API
113 File Systems</ulink>.</para>
114 </refsect1>
115
116 <refsect1>
117 <title><filename>fstab</filename></title>
118
119 <para>Mount units may either be configured via unit files, or via
120 <filename>/etc/fstab</filename> (see
121 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
122 for details). Mounts listed in <filename>/etc/fstab</filename>
123 will be converted into native units dynamically at boot and when
124 the configuration of the system manager is reloaded. In general,
125 configuring mount points through <filename>/etc/fstab</filename>
126 is the preferred approach. See
127 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
128 for details about the conversion.</para>
129
130 <para>When reading <filename>/etc/fstab</filename> a few special
131 mount options are understood by systemd which influence how
132 dependencies are created for mount points. systemd will create a
133 dependency of type <option>Wants</option> or
134 <option>Requires</option> (see option <option>nofail</option>
135 below), from either <filename>local-fs.target</filename> or
136 <filename>remote-fs.target</filename>, depending whether the file
137 system is local or remote.</para>
138
139 <variablelist class='fstab-options'>
140
141 <varlistentry>
142 <term><option>x-systemd.automount</option></term>
143
144 <listitem><para>An automount unit will be created for the file
145 system. See
146 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
147 for details.</para></listitem>
148 </varlistentry>
149
150 <varlistentry>
151 <term><option>x-systemd.idle-timeout=</option></term>
152
153 <listitem><para>Configures the idleness timeout of the
154 automount unit. See <varname>TimeoutIdleSec=</varname> in
155 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
156 for details.</para></listitem>
157 </varlistentry>
158
159 <varlistentry>
160 <term><option>x-systemd.device-timeout=</option></term>
161
162 <listitem><para>Configure how long systemd should wait for a
163 device to show up before giving up on an entry from
164 <filename>/etc/fstab</filename>. Specify a time in seconds or
165 explicitly append a unit as <literal>s</literal>,
166 <literal>min</literal>, <literal>h</literal>,
167 <literal>ms</literal>.</para>
168
169 <para>Note that this option can only be used in
170 <filename>/etc/fstab</filename>, and will be
171 ignored when part of <varname>Options=</varname>
172 setting in a unit file.</para>
173 </listitem>
174 </varlistentry>
175
176 <varlistentry>
177 <term><option>noauto</option></term>
178 <term><option>auto</option></term>
179
180 <listitem><para>With <option>noauto</option>, this mount will
181 not be added as a dependency for
182 <filename>local-fs.target</filename> or
183 <filename>remote-fs.target</filename>. This means that it will
184 not be mounted automatically during boot, unless it is pulled
185 in by some other unit. Option <option>auto</option> has the
186 opposite meaning and is the default.</para>
187 </listitem>
188 </varlistentry>
189
190 <varlistentry>
191 <term><option>nofail</option></term>
192
193 <listitem><para>With <option>nofail</option> this mount will
194 be only wanted, not required, by
195 <filename>local-fs.target</filename> or
196 <filename>remote-fs.target</filename>. This means that the
197 boot will continue even if this mount point is not mounted
198 successfully.</para>
199 </listitem>
200 </varlistentry>
201
202 <varlistentry>
203 <term><option>x-initrd.mount</option></term>
204
205 <listitem><para>An additional filesystem to be mounted in the
206 initramfs. See <filename>initrd-fs.target</filename>
207 description in
208 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
209 </para></listitem>
210 </varlistentry>
211 </variablelist>
212
213 <para>If a mount point is configured in both
214 <filename>/etc/fstab</filename> and a unit file that is stored
215 below <filename>/usr</filename>, the former will take precedence.
216 If the unit file is stored below <filename>/etc</filename>, it
217 will take precedence. This means: native unit files take
218 precedence over traditional configuration files, but this is
219 superseded by the rule that configuration in
220 <filename>/etc</filename> will always take precedence over
221 configuration in <filename>/usr</filename>.</para>
222 </refsect1>
223
224 <refsect1>
225 <title>Options</title>
226
227 <para>Mount files must include a [Mount] section, which carries
228 information about the file system mount points it supervises. A
229 number of options that may be used in this section are shared with
230 other unit types. These options are documented in
231 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
232 and
233 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
234 The options specific to the [Mount] section of mount units are the
235 following:</para>
236
237 <variablelist class='unit-directives'>
238
239 <varlistentry>
240 <term><varname>What=</varname></term>
241 <listitem><para>Takes an absolute path of a device node, file
242 or other resource to mount. See
243 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
244 for details. If this refers to a device node, a dependency on
245 the respective device unit is automatically created. (See
246 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
247 for more information.) This option is
248 mandatory.</para></listitem>
249 </varlistentry>
250
251 <varlistentry>
252 <term><varname>Where=</varname></term>
253 <listitem><para>Takes an absolute path of a directory of the
254 mount point. If the mount point does not exist at the time of
255 mounting, it is created. This string must be reflected in the
256 unit filename. (See above.) This option is
257 mandatory.</para></listitem>
258 </varlistentry>
259
260 <varlistentry>
261 <term><varname>Type=</varname></term>
262 <listitem><para>Takes a string for the file system type. See
263 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
264 for details. This setting is optional.</para></listitem>
265 </varlistentry>
266
267 <varlistentry>
268 <term><varname>Options=</varname></term>
269
270 <listitem><para>Mount options to use when mounting. This takes
271 a comma-separated list of options. This setting is
272 optional.</para></listitem>
273 </varlistentry>
274
275 <varlistentry>
276 <term><varname>SloppyOptions=</varname></term>
277
278 <listitem><para>Takes a boolean argument. If true, parsing of
279 the options specified in <varname>Options=</varname> is
280 relaxed, and unknown mount options are tolerated. This
281 corresponds with
282 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
283 <parameter>-s</parameter> switch. Defaults to
284 off.</para></listitem>
285 </varlistentry>
286
287 <varlistentry>
288 <term><varname>DirectoryMode=</varname></term>
289 <listitem><para>Directories of mount points (and any parent
290 directories) are automatically created if needed. This option
291 specifies the file system access mode used when creating these
292 directories. Takes an access mode in octal notation. Defaults
293 to 0755.</para></listitem>
294 </varlistentry>
295
296 <varlistentry>
297 <term><varname>TimeoutSec=</varname></term>
298 <listitem><para>Configures the time to wait for the mount
299 command to finish. If a command does not exit within the
300 configured time, the mount will be considered failed and be
301 shut down again. All commands still running will be terminated
302 forcibly via <constant>SIGTERM</constant>, and after another
303 delay of this time with <constant>SIGKILL</constant>. (See
304 <option>KillMode=</option> in
305 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
306 Takes a unit-less value in seconds, or a time span value such
307 as "5min 20s". Pass 0 to disable the timeout logic. The
308 default value is set from the manager configuration file's
309 <varname>DefaultTimeoutStart=</varname>
310 variable.</para></listitem>
311 </varlistentry>
312 </variablelist>
313
314 <para>Check
315 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
316 and
317 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
318 for more settings.</para>
319 </refsect1>
320
321 <refsect1>
322 <title>See Also</title>
323 <para>
324 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
325 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
326 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
327 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
328 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
329 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
330 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
331 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
332 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
333 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
334 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
335 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
336 </para>
337 </refsect1>
338
339 </refentry>