]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.mount.xml
Merge pull request #1989 from keszybz/filetriggers-v2
[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>.
92 Note that mount units cannot be templated.</para>
93
94 <para>Optionally, a mount unit may be accompanied by an automount
95 unit, to allow on-demand or parallelized mounting. See
96 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
97
98 <para>Mount points created at runtime (independently of unit files
99 or <filename>/etc/fstab</filename>) will be monitored by systemd
100 and appear like any other mount unit in systemd. See
101 <filename>/proc/self/mountinfo</filename> description in
102 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
103 </para>
104
105 <para>Some file systems have special semantics as API file systems
106 for kernel-to-userspace and userspace-to-userspace interfaces. Some
107 of them may not be changed via mount units, and cannot be
108 disabled. For a longer discussion see <ulink
109 url="http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems">API
110 File Systems</ulink>.</para>
111 </refsect1>
112
113 <refsect1>
114 <title>Automatic Dependencies</title>
115
116 <para>If a mount unit is beneath another mount unit in the file
117 system hierarchy, both a requirement dependency and an ordering
118 dependency between both units are created automatically.</para>
119
120 <para>Block device backed file systems automatically gain
121 <varname>BindsTo=</varname> and <varname>After=</varname> type
122 dependencies on the device unit encapsulating the block
123 device (see below).</para>
124
125 <para>If traditional file system quota is enabled for a mount
126 unit, automatic <varname>Wants=</varname> and
127 <varname>Before=</varname> dependencies on
128 <filename>systemd-quotacheck.service</filename> and
129 <filename>quotaon.service</filename> are added.</para>
130
131 <para>For mount units with
132 <varname>DefaultDependencies=yes</varname> (the default) a couple
133 additional dependencies are added. Mount units referring to local
134 file systems automatically gain an <varname>After=</varname>
135 dependency on <filename>local-fs-pre.target</filename>. Network
136 mount units automatically acquire <varname>After=</varname>
137 dependencies on <filename>remote-fs-pre.target</filename>,
138 <filename>network.target</filename> and
139 <filename>network-online.target</filename>. Towards the latter a
140 <varname>Wants=</varname> unit is added as well. Mount units
141 referring to local and network file systems are distinguished by
142 their file system type specification. In some cases this is not
143 sufficient (for example network block device based mounts, such as
144 iSCSI), in which case <option>_netdev</option> may be added to the
145 mount option string of the unit, which forces systemd to consider the
146 mount unit a network mount. Mount units (regardless if local or
147 network) also acquire automatic <varname>Before=</varname> and
148 <varname>Conflicts=</varname> on
149 <filename>umount.target</filename> in order to be stopped
150 during shutdown.</para>
151
152 <para>Additional implicit dependencies may be added as result of
153 execution and resource control parameters as documented in
154 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
155 and
156 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
157 </refsect1>
158
159 <refsect1>
160 <title><filename>fstab</filename></title>
161
162 <para>Mount units may either be configured via unit files, or via
163 <filename>/etc/fstab</filename> (see
164 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
165 for details). Mounts listed in <filename>/etc/fstab</filename>
166 will be converted into native units dynamically at boot and when
167 the configuration of the system manager is reloaded. In general,
168 configuring mount points through <filename>/etc/fstab</filename>
169 is the preferred approach. See
170 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
171 for details about the conversion.</para>
172
173 <para>When reading <filename>/etc/fstab</filename> a few special
174 mount options are understood by systemd which influence how
175 dependencies are created for mount points. systemd will create a
176 dependency of type <varname>Wants=</varname> or
177 <option>Requires</option> (see option <option>nofail</option>
178 below), from either <filename>local-fs.target</filename> or
179 <filename>remote-fs.target</filename>, depending whether the file
180 system is local or remote.</para>
181
182 <variablelist class='fstab-options'>
183
184 <varlistentry>
185 <term><option>x-systemd.requires=</option></term>
186
187 <listitem><para>Configures a <varname>Requires=</varname> and
188 an <varname>After=</varname> dependency between the created
189 mount unit and another systemd unit, such as a device or mount
190 unit. The argument should be a unit name, or an absolute path
191 to a device node or mount point. This option may be specified
192 more than once. This option is particularly useful for mount
193 point declarations that need an additional device to be around
194 (such as an external journal device for journal file systems)
195 or an additional mount to be in place (such as an overlay file
196 system that merges multiple mount points). See
197 <varname>After=</varname> and <varname>Requires=</varname> in
198 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
199 for details.</para></listitem>
200 </varlistentry>
201
202 <varlistentry>
203 <term><option>x-systemd.requires-mounts-for=</option></term>
204
205 <listitem><para>Configures a
206 <varname>RequiresMountsFor=</varname> dependency between the
207 created mount unit and other mount units. The argument must be
208 an absolute path. This option may be specified more than once.
209 See <varname>RequiresMountsFor=</varname> in
210 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
211 for details.</para></listitem>
212 </varlistentry>
213
214 <varlistentry>
215 <term><option>x-systemd.automount</option></term>
216
217 <listitem><para>An automount unit will be created for the file
218 system. See
219 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
220 for details.</para></listitem>
221 </varlistentry>
222
223 <varlistentry>
224 <term><option>x-systemd.idle-timeout=</option></term>
225
226 <listitem><para>Configures the idle timeout of the
227 automount unit. See <varname>TimeoutIdleSec=</varname> in
228 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
229 for details.</para></listitem>
230 </varlistentry>
231
232 <varlistentry>
233 <term><option>x-systemd.device-timeout=</option></term>
234
235 <listitem><para>Configure how long systemd should wait for a
236 device to show up before giving up on an entry from
237 <filename>/etc/fstab</filename>. Specify a time in seconds or
238 explicitly append a unit such as <literal>s</literal>,
239 <literal>min</literal>, <literal>h</literal>,
240 <literal>ms</literal>.</para>
241
242 <para>Note that this option can only be used in
243 <filename>/etc/fstab</filename>, and will be
244 ignored when part of the <varname>Options=</varname>
245 setting in a unit file.</para>
246 </listitem>
247 </varlistentry>
248
249 <varlistentry>
250 <term><option>noauto</option></term>
251 <term><option>auto</option></term>
252
253 <listitem><para>With <option>noauto</option>, this mount will
254 not be added as a dependency for
255 <filename>local-fs.target</filename> or
256 <filename>remote-fs.target</filename>. This means that it will
257 not be mounted automatically during boot, unless it is pulled
258 in by some other unit. The <option>auto</option> option has the
259 opposite meaning and is the default.</para>
260 </listitem>
261 </varlistentry>
262
263 <varlistentry>
264 <term><option>nofail</option></term>
265
266 <listitem><para>With <option>nofail</option>, this mount will
267 be only wanted, not required, by
268 <filename>local-fs.target</filename> or
269 <filename>remote-fs.target</filename>. This means that the
270 boot will continue even if this mount point is not mounted
271 successfully.</para>
272 </listitem>
273 </varlistentry>
274
275 <varlistentry>
276 <term><option>x-initrd.mount</option></term>
277
278 <listitem><para>An additional filesystem to be mounted in the
279 initramfs. See <filename>initrd-fs.target</filename>
280 description in
281 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
282 </para></listitem>
283 </varlistentry>
284 </variablelist>
285
286 <para>If a mount point is configured in both
287 <filename>/etc/fstab</filename> and a unit file that is stored
288 below <filename>/usr</filename>, the former will take precedence.
289 If the unit file is stored below <filename>/etc</filename>, it
290 will take precedence. This means: native unit files take
291 precedence over traditional configuration files, but this is
292 superseded by the rule that configuration in
293 <filename>/etc</filename> will always take precedence over
294 configuration in <filename>/usr</filename>.</para>
295 </refsect1>
296
297 <refsect1>
298 <title>Options</title>
299
300 <para>Mount files must include a [Mount] section, which carries
301 information about the file system mount points it supervises. A
302 number of options that may be used in this section are shared with
303 other unit types. These options are documented in
304 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
305 and
306 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
307 The options specific to the [Mount] section of mount units are the
308 following:</para>
309
310 <variablelist class='unit-directives'>
311
312 <varlistentry>
313 <term><varname>What=</varname></term>
314 <listitem><para>Takes an absolute path of a device node, file
315 or other resource to mount. See
316 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
317 for details. If this refers to a device node, a dependency on
318 the respective device unit is automatically created. (See
319 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
320 for more information.) This option is
321 mandatory.</para></listitem>
322 </varlistentry>
323
324 <varlistentry>
325 <term><varname>Where=</varname></term>
326 <listitem><para>Takes an absolute path of a directory of the
327 mount point. If the mount point does not exist at the time of
328 mounting, it is created. This string must be reflected in the
329 unit filename. (See above.) This option is
330 mandatory.</para></listitem>
331 </varlistentry>
332
333 <varlistentry>
334 <term><varname>Type=</varname></term>
335 <listitem><para>Takes a string for the file system type. See
336 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
337 for details. This setting is optional.</para></listitem>
338 </varlistentry>
339
340 <varlistentry>
341 <term><varname>Options=</varname></term>
342
343 <listitem><para>Mount options to use when mounting. This takes
344 a comma-separated list of options. This setting is
345 optional.</para></listitem>
346 </varlistentry>
347
348 <varlistentry>
349 <term><varname>SloppyOptions=</varname></term>
350
351 <listitem><para>Takes a boolean argument. If true, parsing of
352 the options specified in <varname>Options=</varname> is
353 relaxed, and unknown mount options are tolerated. This
354 corresponds with
355 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
356 <parameter>-s</parameter> switch. Defaults to
357 off.</para></listitem>
358 </varlistentry>
359
360 <varlistentry>
361 <term><varname>DirectoryMode=</varname></term>
362 <listitem><para>Directories of mount points (and any parent
363 directories) are automatically created if needed. This option
364 specifies the file system access mode used when creating these
365 directories. Takes an access mode in octal notation. Defaults
366 to 0755.</para></listitem>
367 </varlistentry>
368
369 <varlistentry>
370 <term><varname>TimeoutSec=</varname></term>
371 <listitem><para>Configures the time to wait for the mount
372 command to finish. If a command does not exit within the
373 configured time, the mount will be considered failed and be
374 shut down again. All commands still running will be terminated
375 forcibly via <constant>SIGTERM</constant>, and after another
376 delay of this time with <constant>SIGKILL</constant>. (See
377 <option>KillMode=</option> in
378 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
379 Takes a unit-less value in seconds, or a time span value such
380 as "5min 20s". Pass 0 to disable the timeout logic. The
381 default value is set from the manager configuration file's
382 <varname>DefaultTimeoutStart=</varname>
383 variable.</para></listitem>
384 </varlistentry>
385 </variablelist>
386
387 <para>Check
388 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
389 and
390 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
391 for more settings.</para>
392 </refsect1>
393
394 <refsect1>
395 <title>See Also</title>
396 <para>
397 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
398 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
399 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
400 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
401 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
402 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
403 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
404 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
405 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
406 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
407 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
408 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
409 </para>
410 </refsect1>
411
412 </refentry>