]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.mount.xml
man: use <simplelist> for 'See also' sections
[thirdparty/systemd.git] / man / systemd.mount.xml
CommitLineData
cdb788e4 1<?xml version='1.0'?> <!--*-nxml-*-->
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
cdb788e4 5
d8e1613e 6<refentry id="systemd.mount" xmlns:xi="http://www.w3.org/2001/XInclude">
798d3a52
ZJS
7 <refentryinfo>
8 <title>systemd.mount</title>
9 <productname>systemd</productname>
798d3a52
ZJS
10 </refentryinfo>
11
12 <refmeta>
13 <refentrytitle>systemd.mount</refentrytitle>
14 <manvolnum>5</manvolnum>
15 </refmeta>
16
17 <refnamediv>
18 <refname>systemd.mount</refname>
19 <refpurpose>Mount unit configuration</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23 <para><filename><replaceable>mount</replaceable>.mount</filename></para>
24 </refsynopsisdiv>
25
26 <refsect1>
27 <title>Description</title>
28
29 <para>A unit configuration file whose name ends in
30 <literal>.mount</literal> encodes information about a file system
31 mount point controlled and supervised by systemd.</para>
32
33 <para>This man page lists the configuration options specific to
34 this unit type. See
35 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
36 for the common options of all unit configuration files. The common
bdac5608
ZJS
37 configuration items are configured in the generic [Unit] and
38 [Install] sections. The mount specific configuration options are
39 configured in the [Mount] section.</para>
798d3a52
ZJS
40
41 <para>Additional options are listed in
42 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
43 which define the execution environment the
3ba3a79d 44 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
3f2d1365 45 program is executed in, and in
798d3a52
ZJS
46 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
47 which define the way the processes are terminated, and in
48 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
49 which configure resource control settings for the processes of the
5e0aff56
AJ
50 service.</para>
51
52 <para>Note that the options <varname>User=</varname> and
53 <varname>Group=</varname> are not useful for mount units.
54 systemd passes two parameters to
55 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>;
56 the values of <varname>What=</varname> and <varname>Where=</varname>.
57 When invoked in this way,
3ba3a79d 58 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
5e0aff56
AJ
59 does not read any options from <filename>/etc/fstab</filename>, and
60 must be run as UID 0.</para>
798d3a52 61
19cb8279
ZJS
62 <para>Mount units must be named after the mount point directories they control. Example: the mount point
63 <filename index="false">/home/lennart</filename> must be configured in a unit file
64 <filename>home-lennart.mount</filename>. For details about the escaping logic used to convert a file
65 system path to a unit name, see
66 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Note
67 that mount units cannot be templated, nor is possible to add multiple names to a mount unit by creating
68 symlinks to its unit file.</para>
798d3a52
ZJS
69
70 <para>Optionally, a mount unit may be accompanied by an automount
71 unit, to allow on-demand or parallelized mounting. See
72 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
73
798d3a52
ZJS
74 <para>Mount points created at runtime (independently of unit files
75 or <filename>/etc/fstab</filename>) will be monitored by systemd
76 and appear like any other mount unit in systemd. See
77 <filename>/proc/self/mountinfo</filename> description in
78 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
79 </para>
80
81 <para>Some file systems have special semantics as API file systems
ff9b60f3 82 for kernel-to-userspace and userspace-to-userspace interfaces. Some
798d3a52
ZJS
83 of them may not be changed via mount units, and cannot be
84 disabled. For a longer discussion see <ulink
28a0ad81 85 url="https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems">API
798d3a52 86 File Systems</ulink>.</para>
438e6a48
LP
87
88 <para>The
89 <citerefentry><refentrytitle>systemd-mount</refentrytitle><manvolnum>1</manvolnum></citerefentry> command
90 allows creating <filename>.mount</filename> and <filename>.automount</filename> units dynamically and
91 transiently from the command line.</para>
798d3a52
ZJS
92 </refsect1>
93
c129bd5d 94 <refsect1>
aed5cb03
ZJS
95 <title>Automatic Dependencies</title>
96
97 <refsect2>
98 <title>Implicit Dependencies</title>
99
100 <para>The following dependencies are implicitly added:</para>
101
102 <itemizedlist>
103 <listitem><para>If a mount unit is beneath another mount unit in the file
104 system hierarchy, both a requirement dependency and an ordering
105 dependency between both units are created automatically.</para></listitem>
106
d3a7602d
MY
107 <listitem><para>Block device backed file systems automatically gain <varname>Requires=</varname>,
108 <varname>StopPropagatedFrom=</varname>, and <varname>After=</varname> type dependencies on the
109 device unit encapsulating the block device (see <varname>x-systemd.device-bound=</varname> for details).
110 </para></listitem>
111
112 <listitem><para>If traditional file system quota is enabled for a mount unit, automatic
113 <varname>Wants=</varname> and <varname>Before=</varname> dependencies on
114 <filename>systemd-quotacheck.service</filename> and <filename>quotaon.service</filename>
115 are added.</para></listitem>
116
117 <listitem><para>Additional implicit dependencies may be added as result of execution and
118 resource control parameters as documented in
aed5cb03
ZJS
119 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
120 and
121 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
122 </para></listitem>
123 </itemizedlist>
124 </refsect2>
125
126 <refsect2>
127 <title>Default Dependencies</title>
128
129 <para>The following dependencies are added unless <varname>DefaultDependencies=no</varname> is set:</para>
130
131 <itemizedlist>
132 <listitem><para>All mount units acquire automatic <varname>Before=</varname> and <varname>Conflicts=</varname> on
133 <filename>umount.target</filename> in order to be stopped during shutdown.</para></listitem>
134
135 <listitem><para>Mount units referring to local file systems automatically gain
321cd1c1 136 an <varname>After=</varname> dependency on <filename>local-fs-pre.target</filename>, and a
39a4c452
MY
137 <varname>Before=</varname> dependency on <filename>local-fs.target</filename> unless one or more
138 mount options among <option>nofail</option>, <option>x-systemd.wanted-by=</option>,
f611721f
MY
139 and <option>x-systemd.required-by=</option> is set. See below for detailed information.</para>
140
141 <para>Additionally, an <varname>After=</varname> dependency on <filename>swap.target</filename>
142 is added when the file system type is <literal>tmpfs</literal>.</para>
143 </listitem>
39a4c452
MY
144
145 <listitem><para>Network mount units automatically acquire <varname>After=</varname> dependencies on
146 <filename>remote-fs-pre.target</filename>, <filename>network.target</filename>,
147 plus <varname>After=</varname> and <varname>Wants=</varname> dependencies on <filename>network-online.target</filename>,
148 and a <varname>Before=</varname> dependency on <filename>remote-fs.target</filename>, unless
149 one or more mount options among <option>nofail</option>, <option>x-systemd.wanted-by=</option>,
150 and <option>x-systemd.required-by=</option> is set.</para></listitem>
aed5cb03
ZJS
151 </itemizedlist>
152
153 <para>Mount units referring to local and network file systems are distinguished by their file system type
154 specification. In some cases this is not sufficient (for example network block device based mounts, such as
155 iSCSI), in which case <option>_netdev</option> may be added to the mount option string of the unit, which forces
156 systemd to consider the mount unit a network mount.</para>
157 </refsect2>
c129bd5d
LP
158 </refsect1>
159
798d3a52
ZJS
160 <refsect1>
161 <title><filename>fstab</filename></title>
162
29e804df 163 <para>Mount units may either be configured via unit files, or via <filename>/etc/fstab</filename> (see
3ba3a79d 164 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
29e804df
DDM
165 for details). Mounts listed in <filename>/etc/fstab</filename> will be converted into native units
166 dynamically at boot and when the configuration of the system manager is reloaded. In general, configuring
167 mount points through <filename>/etc/fstab</filename> is the preferred approach to manage mounts for
168 humans. For tooling, writing mount units should be preferred over editing <filename>/etc/fstab</filename>.
169 See <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
170 for details about the conversion from <filename>/etc/fstab</filename> to mount units.</para>
798d3a52 171
773ebc0c 172 <para>The NFS mount option <option>bg</option> for NFS background mounts
0a07667d 173 as documented in <citerefentry project='man-pages'><refentrytitle>nfs</refentrytitle><manvolnum>5</manvolnum></citerefentry>
65e1dee7
N
174 is detected by <command>systemd-fstab-generator</command> and the options
175 are transformed so that systemd fulfills the job-control implications of
176 that option. Specifically <command>systemd-fstab-generator</command> acts
41fc3fab 177 as though <literal>x-systemd.mount-timeout=infinity,retry=10000</literal> was
65e1dee7
N
178 prepended to the option list, and <literal>fg,nofail</literal> was appended.
179 Depending on specific requirements, it may be appropriate to provide some of
180 these options explicitly, or to make use of the
181 <literal>x-systemd.automount</literal> option described below instead
182 of using <literal>bg</literal>.</para>
773ebc0c 183
798d3a52
ZJS
184 <para>When reading <filename>/etc/fstab</filename> a few special
185 mount options are understood by systemd which influence how
186 dependencies are created for mount points. systemd will create a
c129bd5d 187 dependency of type <varname>Wants=</varname> or
a37ef455 188 <option>Requires=</option> (see option <option>nofail</option>
798d3a52
ZJS
189 below), from either <filename>local-fs.target</filename> or
190 <filename>remote-fs.target</filename>, depending whether the file
191 system is local or remote.</para>
192
193 <variablelist class='fstab-options'>
194
3519d230
KZ
195 <varlistentry>
196 <term><option>x-systemd.requires=</option></term>
197
198 <listitem><para>Configures a <varname>Requires=</varname> and
199 an <varname>After=</varname> dependency between the created
200 mount unit and another systemd unit, such as a device or mount
201 unit. The argument should be a unit name, or an absolute path
202 to a device node or mount point. This option may be specified
203 more than once. This option is particularly useful for mount
204 point declarations that need an additional device to be around
205 (such as an external journal device for journal file systems)
206 or an additional mount to be in place (such as an overlay file
207 system that merges multiple mount points). See
208 <varname>After=</varname> and <varname>Requires=</varname> in
209 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
045c5faf
FB
210 for details.</para>
211
212 <para>Note that this option always applies to the created mount unit
213 only regardless whether <option>x-systemd.automount</option> has been
ec07c3c8
AK
214 specified.</para>
215
216 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
3519d230
KZ
217 </varlistentry>
218
ae325185
RB
219 <varlistentry>
220 <term><option>x-systemd.before=</option></term>
221 <term><option>x-systemd.after=</option></term>
222
81248e7f
AR
223 <listitem><para>In the created mount unit, configures a
224 <varname>Before=</varname> or <varname>After=</varname>
225 dependency on another systemd unit, such as a mount unit.
ae325185
RB
226 The argument should be a unit name or an absolute path
227 to a mount point. This option may be specified more than once.
228 This option is particularly useful for mount point declarations
229 with <option>nofail</option> option that are mounted
230 asynchronously but need to be mounted before or after some unit
231 start, for example, before <filename>local-fs.target</filename>
232 unit.
233 See <varname>Before=</varname> and <varname>After=</varname> in
234 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
045c5faf
FB
235 for details.</para>
236
237 <para>Note that these options always apply to the created mount unit
238 only regardless whether <option>x-systemd.automount</option> has been
ec07c3c8
AK
239 specified.</para>
240
241 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
ae325185
RB
242 </varlistentry>
243
be02c1cf
AR
244 <varlistentry>
245 <term><option>x-systemd.wanted-by=</option></term>
246 <term><option>x-systemd.required-by=</option></term>
247
39a4c452
MY
248 <listitem><para>In the created mount unit, configures a <varname>WantedBy=</varname> or
249 <varname>RequiredBy=</varname> dependency on another unit. This option may be specified more than once.
250 If this is specified, the default dependencies (see above) other than <filename>umount.target</filename>
251 on the created mount unit, e.g. <filename>local-fs.target</filename>, are not automatically created.
252 Hence it is likely that some ordering dependencies need to be set up manually through
253 <option>x-systemd.before=</option> and <option>x-systemd.after=</option>. See <varname>WantedBy=</varname>
254 and <varname>RequiredBy=</varname> in
be02c1cf 255 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
ec07c3c8
AK
256 for details.</para>
257
258 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
be02c1cf
AR
259 </varlistentry>
260
3519d230 261 <varlistentry>
9e615fa3 262 <term><option>x-systemd.wants-mounts-for=</option></term>
3519d230
KZ
263 <term><option>x-systemd.requires-mounts-for=</option></term>
264
265 <listitem><para>Configures a
9e615fa3
LB
266 <varname>RequiresMountsFor=</varname> or <varname>WantsMountsFor=</varname>
267 dependency between the created mount unit and other mount units. The
268 argument must be an absolute path. This option may be specified more than
269 once. See <varname>RequiresMountsFor=</varname> or <varname>WantsMountsFor=</varname> in
3519d230 270 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
ec07c3c8
AK
271 for details.</para>
272
273 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
3519d230
KZ
274 </varlistentry>
275
ebc8968b 276 <varlistentry>
707ecf14
MY
277 <term><option>x-systemd.device-bound=</option></term>
278
279 <listitem><para>Takes a boolean argument. If true or no argument, a <varname>BindsTo=</varname> dependency
280 on the backing device is set. If false, the mount unit is not stopped no matter whether the backing device
281 is still present. This is useful when the file system is backed by volume managers. If not set, and the mount
282 comes from unit fragments, i.e. generated from <filename>/etc/fstab</filename> by <citerefentry>
283 <refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> or loaded from
284 a manually configured mount unit, a combination of <varname>Requires=</varname> and <varname>StopPropagatedFrom=</varname>
285 dependencies is set on the backing device. If doesn't, only <varname>Requires=</varname> is used.</para>
ec07c3c8
AK
286
287 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
ebc8968b
FB
288 </varlistentry>
289
798d3a52
ZJS
290 <varlistentry>
291 <term><option>x-systemd.automount</option></term>
292
293 <listitem><para>An automount unit will be created for the file
294 system. See
295 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
aefdc112
AK
296 for details.</para>
297
298 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
798d3a52
ZJS
299 </varlistentry>
300
deb0a77c
MO
301 <varlistentry>
302 <term><option>x-systemd.idle-timeout=</option></term>
303
a8eaaee7 304 <listitem><para>Configures the idle timeout of the
deb0a77c
MO
305 automount unit. See <varname>TimeoutIdleSec=</varname> in
306 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
ec07c3c8
AK
307 for details.</para>
308
309 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
deb0a77c
MO
310 </varlistentry>
311
f0c5cda2 312 <varlistentry id='device-timeout'>
798d3a52
ZJS
313 <term><option>x-systemd.device-timeout=</option></term>
314
315 <listitem><para>Configure how long systemd should wait for a
316 device to show up before giving up on an entry from
317 <filename>/etc/fstab</filename>. Specify a time in seconds or
a8eaaee7 318 explicitly append a unit such as <literal>s</literal>,
798d3a52
ZJS
319 <literal>min</literal>, <literal>h</literal>,
320 <literal>ms</literal>.</para>
321
322 <para>Note that this option can only be used in
323 <filename>/etc/fstab</filename>, and will be
a8eaaee7 324 ignored when part of the <varname>Options=</varname>
798d3a52 325 setting in a unit file.</para>
aefdc112
AK
326
327 <xi:include href="version-info.xml" xpointer="v215"/>
798d3a52
ZJS
328 </listitem>
329 </varlistentry>
330
110773f6
CH
331 <varlistentry>
332 <term><option>x-systemd.mount-timeout=</option></term>
333
334 <listitem><para>Configure how long systemd should wait for the
335 mount command to finish before giving up on an entry from
336 <filename>/etc/fstab</filename>. Specify a time in seconds or
337 explicitly append a unit such as <literal>s</literal>,
338 <literal>min</literal>, <literal>h</literal>,
339 <literal>ms</literal>.</para>
340
341 <para>Note that this option can only be used in
342 <filename>/etc/fstab</filename>, and will be
343 ignored when part of the <varname>Options=</varname>
344 setting in a unit file.</para>
345
346 <para>See <varname>TimeoutSec=</varname> below for
347 details.</para>
ec07c3c8
AK
348
349 <xi:include href="version-info.xml" xpointer="v233"/>
110773f6
CH
350 </listitem>
351 </varlistentry>
0f00528d 352
58e0ac33
ZJS
353 <varlistentry>
354 <term><option>x-systemd.makefs</option></term>
355
f0c5cda2 356 <listitem><para>The file system will be initialized
58e0ac33
ZJS
357 on the device. If the device is not "empty", i.e. it contains any signature,
358 the operation will be skipped. It is hence expected that this option
5238e957 359 remains set even after the device has been initialized.</para>
58e0ac33
ZJS
360
361 <para>Note that this option can only be used in
362 <filename>/etc/fstab</filename>, and will be ignored when part of the
363 <varname>Options=</varname> setting in a unit file.</para>
364
365 <para>See
366 <citerefentry><refentrytitle>systemd-makefs@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
367 </para>
368
369 <para><citerefentry project='man-pages'><refentrytitle>wipefs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
370 may be used to remove any signatures from a block device to force
371 <option>x-systemd.makefs</option> to reinitialize the device.</para>
ec07c3c8
AK
372
373 <xi:include href="version-info.xml" xpointer="v236"/>
58e0ac33
ZJS
374 </listitem>
375 </varlistentry>
376
377 <varlistentry>
378 <term><option>x-systemd.growfs</option></term>
379
380 <listitem><para>The file system will be grown to occupy the full block
381 device. If the file system is already at maximum size, no action will
382 be performed. It is hence expected that this option remains set even after
383 the file system has been grown. Only certain file system types are supported,
384 see
385 <citerefentry><refentrytitle>systemd-makefs@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
386 for details.</para>
387
388 <para>Note that this option can only be used in
389 <filename>/etc/fstab</filename>, and will be ignored when part of the
ec07c3c8
AK
390 <varname>Options=</varname> setting in a unit file.</para>
391
392 <xi:include href="version-info.xml" xpointer="v236"/></listitem>
58e0ac33
ZJS
393 </varlistentry>
394
2bd33c90
LP
395 <varlistentry>
396 <term><option>x-systemd.pcrfs</option></term>
397
398 <listitem><para>Measures file system identity information (mount point, type, label, UUID, partition
399 label, partition UUID) into PCR 15 after the file system has been mounted. This ensures the
400 <citerefentry><refentrytitle>systemd-pcrfs@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
401 or <filename>systemd-pcrfs-root.service</filename> services are pulled in by the mount unit.</para>
402
403 <para>Note that this option can only be used in <filename>/etc/fstab</filename>, and will be ignored
404 when part of the <varname>Options=</varname> setting in a unit file. It is also implied for the root
d09df6b9 405 and <filename>/usr/</filename> partitions discovered by
ec07c3c8
AK
406 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
407
408 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
2bd33c90
LP
409 </varlistentry>
410
ad765605
MH
411 <varlistentry>
412 <term><option>x-systemd.rw-only</option></term>
413
414 <listitem><para>If a mount operation fails to mount the file system
415 read-write, it normally tries mounting the file system read-only instead.
416 This option disables that behaviour, and causes the mount to fail
417 immediately instead. This option is translated into the
418 <varname>ReadWriteOnly=</varname> setting in a unit file.</para>
ec07c3c8
AK
419
420 <xi:include href="version-info.xml" xpointer="v246"/>
ad765605
MH
421 </listitem>
422 </varlistentry>
423
0f00528d
ZJS
424 <varlistentry>
425 <term><option>_netdev</option></term>
426
427 <listitem><para>Normally the file system type is used to determine if a
428 mount is a "network mount", i.e. if it should only be started after the
429 network is available. Using this option overrides this detection and
430 specifies that the mount requires network.</para>
431
432 <para>Network mount units are ordered between <filename>remote-fs-pre.target</filename>
433 and <filename>remote-fs.target</filename>, instead of
434 <filename>local-fs-pre.target</filename> and <filename>local-fs.target</filename>.
435 They also pull in <filename>network-online.target</filename> and are ordered after
436 it and <filename>network.target</filename>.</para>
ec07c3c8
AK
437
438 <xi:include href="version-info.xml" xpointer="v235"/>
0f00528d
ZJS
439 </listitem>
440 </varlistentry>
441
798d3a52
ZJS
442 <varlistentry>
443 <term><option>noauto</option></term>
444 <term><option>auto</option></term>
445
0c08bc7f 446 <listitem><para>With <option>noauto</option>, the mount unit will not be added as a dependency for
55fabe92
ZJS
447 <filename>local-fs.target</filename> or <filename>remote-fs.target</filename>. This means that it
448 will not be mounted automatically during boot, unless it is pulled in by some other unit. The
449 <option>auto</option> option has the opposite meaning and is the default.</para>
450
451 <para>Note that if <option>x-systemd.automount</option> (see above) is used, neither
452 <option>auto</option> nor <option>noauto</option> have any effect. The matching automount unit will
453 be added as a dependency to the appropriate target.</para>
aefdc112
AK
454
455 <xi:include href="version-info.xml" xpointer="v215"/>
798d3a52
ZJS
456 </listitem>
457 </varlistentry>
458
459 <varlistentry>
460 <term><option>nofail</option></term>
461
e6c7c7ff
LP
462 <listitem><para>With <option>nofail</option>, this mount will be only wanted, not required, by
463 <filename>local-fs.target</filename> or <filename>remote-fs.target</filename>. Moreover the mount unit is not
464 ordered before these target units. This means that the boot will continue without waiting for the mount unit
465 and regardless whether the mount point can be mounted successfully.</para>
aefdc112
AK
466
467 <xi:include href="version-info.xml" xpointer="v215"/>
798d3a52
ZJS
468 </listitem>
469 </varlistentry>
470
471 <varlistentry>
472 <term><option>x-initrd.mount</option></term>
473
32e27670
LP
474 <listitem><para>An additional filesystem to be mounted in the initrd. See
475 <filename>initrd-fs.target</filename> description in
4de66581
LP
476 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>. This
477 is both an indicator to the initrd to mount this partition early and an indicator to the host to
478 leave the partition mounted until final shutdown. Or in other words, if this flag is set it is
479 assumed the mount shall be active during the entire regular runtime of the system, i.e. established
480 before the initrd transitions into the host all the way until the host transitions to the final
aefdc112
AK
481 shutdown phase.</para>
482
483 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
798d3a52
ZJS
484 </varlistentry>
485 </variablelist>
486
487 <para>If a mount point is configured in both
488 <filename>/etc/fstab</filename> and a unit file that is stored
3b121157
ZJS
489 below <filename>/usr/</filename>, the former will take precedence.
490 If the unit file is stored below <filename>/etc/</filename>, it
798d3a52
ZJS
491 will take precedence. This means: native unit files take
492 precedence over traditional configuration files, but this is
493 superseded by the rule that configuration in
3b121157
ZJS
494 <filename>/etc/</filename> will always take precedence over
495 configuration in <filename>/usr/</filename>.</para>
798d3a52
ZJS
496 </refsect1>
497
498 <refsect1>
499 <title>Options</title>
500
d8e1613e
ZJS
501 <para>Mount unit files may include [Unit] and [Install] sections, which are described in
502 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
503 </para>
504
505 <para>Mount unit files must include a [Mount] section, which carries
798d3a52
ZJS
506 information about the file system mount points it supervises. A
507 number of options that may be used in this section are shared with
508 other unit types. These options are documented in
509 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
510 and
511 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
512 The options specific to the [Mount] section of mount units are the
513 following:</para>
514
515 <variablelist class='unit-directives'>
516
517 <varlistentry>
518 <term><varname>What=</varname></term>
151a7133
LP
519 <listitem><para>Takes an absolute path of a device node, file or other resource to mount. See
520 <citerefentry
521 project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> for
522 details. If this refers to a device node, a dependency on the respective device unit is automatically
523 created. (See
524 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
525 for more information.) This option is mandatory. Note that the usual specifier expansion is applied
6dbf4025
ZJS
526 to this setting, literal percent characters should hence be written as <literal
527 class='specifiers'>%%</literal>. If this mount is a bind mount and the specified path does not exist
528 yet it is created as directory.</para></listitem>
798d3a52
ZJS
529 </varlistentry>
530
531 <varlistentry>
532 <term><varname>Where=</varname></term>
f9951b0c
LP
533 <listitem><para>Takes an absolute path of a file or directory for the mount point; in particular, the
534 destination cannot be a symbolic link. If the mount point does not exist at the time of mounting, it
218cfe23
DT
535 is created as either a directory or a file. The former is the usual case; the latter is done only if this mount
536 is a bind mount and the source (<varname>What=</varname>) is not a directory.
537 This string must be reflected in the unit filename. (See above.) This option
f9951b0c 538 is mandatory.</para></listitem>
798d3a52
ZJS
539 </varlistentry>
540
541 <varlistentry>
542 <term><varname>Type=</varname></term>
543 <listitem><para>Takes a string for the file system type. See
3ba3a79d 544 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
6c75eff6
LB
545 for details. This setting is optional.</para>
546
547 <para>If the type is <literal>overlay</literal>, and <literal>upperdir=</literal> or
548 <literal>workdir=</literal> are specified as options and they don't exist, they will be created.
549 </para></listitem>
798d3a52
ZJS
550 </varlistentry>
551
552 <varlistentry>
553 <term><varname>Options=</varname></term>
554
d5cc4be2
LP
555 <listitem><para>Mount options to use when mounting. This takes a comma-separated list of options. This setting
556 is optional. Note that the usual specifier expansion is applied to this setting, literal percent characters
6dbf4025 557 should hence be written as <literal class='specifiers'>%%</literal>.</para></listitem>
798d3a52
ZJS
558 </varlistentry>
559
560 <varlistentry>
561 <term><varname>SloppyOptions=</varname></term>
562
563 <listitem><para>Takes a boolean argument. If true, parsing of
564 the options specified in <varname>Options=</varname> is
565 relaxed, and unknown mount options are tolerated. This
566 corresponds with
3ba3a79d 567 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
798d3a52 568 <parameter>-s</parameter> switch. Defaults to
ec07c3c8
AK
569 off.</para>
570
571 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
798d3a52 572 </varlistentry>
e520950a
BR
573
574 <varlistentry>
575 <term><varname>LazyUnmount=</varname></term>
576
577 <listitem><para>Takes a boolean argument. If true, detach the
578 filesystem from the filesystem hierarchy at time of the unmount
579 operation, and clean up all references to the filesystem as
580 soon as they are not busy anymore.
581 This corresponds with
582 <citerefentry project='man-pages'><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
583 <parameter>-l</parameter> switch. Defaults to
ec07c3c8
AK
584 off.</para>
585
586 <xi:include href="version-info.xml" xpointer="v232"/></listitem>
e520950a 587 </varlistentry>
4f8d40a9 588
75f4bd7f
MH
589 <varlistentry>
590 <term><varname>ReadWriteOnly=</varname></term>
591
592 <listitem><para>Takes a boolean argument. If false, a mount
593 point that shall be mounted read-write but cannot be mounted
594 so is retried to be mounted read-only. If true the operation
595 will fail immediately after the read-write mount attempt did
596 not succeed. This corresponds with
597 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
598 <parameter>-w</parameter> switch. Defaults to
ec07c3c8
AK
599 off.</para>
600
601 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
75f4bd7f
MH
602 </varlistentry>
603
4f8d40a9
BR
604 <varlistentry>
605 <term><varname>ForceUnmount=</varname></term>
606
607 <listitem><para>Takes a boolean argument. If true, force an
608 unmount (in case of an unreachable NFS system).
609 This corresponds with
610 <citerefentry project='man-pages'><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
611 <parameter>-f</parameter> switch. Defaults to
ec07c3c8
AK
612 off.</para>
613
614 <xi:include href="version-info.xml" xpointer="v232"/></listitem>
4f8d40a9 615 </varlistentry>
798d3a52
ZJS
616
617 <varlistentry>
618 <term><varname>DirectoryMode=</varname></term>
619 <listitem><para>Directories of mount points (and any parent
620 directories) are automatically created if needed. This option
621 specifies the file system access mode used when creating these
622 directories. Takes an access mode in octal notation. Defaults
623 to 0755.</para></listitem>
624 </varlistentry>
625
626 <varlistentry>
627 <term><varname>TimeoutSec=</varname></term>
628 <listitem><para>Configures the time to wait for the mount
629 command to finish. If a command does not exit within the
630 configured time, the mount will be considered failed and be
631 shut down again. All commands still running will be terminated
632 forcibly via <constant>SIGTERM</constant>, and after another
633 delay of this time with <constant>SIGKILL</constant>. (See
634 <option>KillMode=</option> in
635 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
636 Takes a unit-less value in seconds, or a time span value such
637 as "5min 20s". Pass 0 to disable the timeout logic. The
7e68a33b
YW
638 default value is set from <varname>DefaultTimeoutStartSec=</varname> option in
639 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
640 </para></listitem>
798d3a52
ZJS
641 </varlistentry>
642 </variablelist>
643
d8e1613e 644 <xi:include href="systemd.service.xml" xpointer="shared-unit-options" />
798d3a52
ZJS
645 </refsect1>
646
647 <refsect1>
648 <title>See Also</title>
13a69c12
DT
649 <para><simplelist type="inline">
650 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
651 <member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
652 <member><citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
653 <member><citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
654 <member><citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
655 <member><citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
656 <member><citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
657 <member><citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
658 <member><citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
659 <member><citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
660 <member><citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
661 <member><citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
662 <member><citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
663 <member><citerefentry><refentrytitle>systemd-mount</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
664 </simplelist></para>
798d3a52 665 </refsect1>
cdb788e4
LP
666
667</refentry>