Debian Codegraph @

man/systemd.mount.xml

raw
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="systemd.mount" xmlns:xi="http://www.w3.org/2001/XInclude">
7 <refentryinfo>
8 <title>systemd.mount</title>
9 <productname>systemd</productname>
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
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>
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
44 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
45 program is executed in, and in
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
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,
58 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
59 does not read any options from <filename>/etc/fstab</filename>, and
60 must be run as UID 0.</para>
61
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>
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
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
82 for kernel-to-userspace and userspace-to-userspace interfaces. Some
83 of them may not be changed via mount units, and cannot be
84 disabled. For a longer discussion see <ulink
85 url="https://systemd.io/API_FILE_SYSTEMS">API
86 File Systems</ulink>.</para>
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>
92 </refsect1>
93
94 <refsect1>
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
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>[email protected]</filename> and <filename>[email protected]</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
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
136 an <varname>After=</varname> dependency on <filename>local-fs-pre.target</filename>, and a
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>,
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>
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>
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>
158 </refsect1>
159
160 <refsect1>
161 <title><filename>fstab</filename></title>
162
163 <para>Mount units may either be configured via unit files, or via <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> 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>
171
172 <para>The NFS mount option <option>bg</option> for NFS background mounts
173 as documented in <citerefentry project='man-pages'><refentrytitle>nfs</refentrytitle><manvolnum>5</manvolnum></citerefentry>
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
177 as though <literal>x-systemd.mount-timeout=infinity,retry=10000</literal> was
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>
183
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
187 dependency of type <varname>Wants=</varname> or
188 <option>Requires=</option> (see option <option>nofail</option>
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
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>
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
214 specified.</para>
215
216 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
217 </varlistentry>
218
219 <varlistentry>
220 <term><option>x-systemd.wants=</option></term>
221
222 <listitem><para>Configures a <varname>Wants=</varname> and
223 an <varname>After=</varname> dependency between the created
224 mount unit and another systemd unit, similar to the
225 <varname>x-systemd.requires=</varname> option.</para>
226
227 <xi:include href="version-info.xml" xpointer="v257"/></listitem>
228 </varlistentry>
229
230 <varlistentry>
231 <term><option>x-systemd.before=</option></term>
232 <term><option>x-systemd.after=</option></term>
233
234 <listitem><para>In the created mount unit, configures a
235 <varname>Before=</varname> or <varname>After=</varname>
236 dependency on another systemd unit, such as a mount unit.
237 The argument should be a unit name or an absolute path
238 to a mount point. This option may be specified more than once.
239 This option is particularly useful for mount point declarations
240 with <option>nofail</option> option that are mounted
241 asynchronously but need to be mounted before or after some unit
242 start, for example, before <filename>local-fs.target</filename>
243 unit.
244 See <varname>Before=</varname> and <varname>After=</varname> in
245 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
246 for details.</para>
247
248 <para>Note that these options always apply to the created mount unit
249 only regardless whether <option>x-systemd.automount</option> has been
250 specified.</para>
251
252 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
253 </varlistentry>
254
255 <varlistentry>
256 <term><option>x-systemd.wanted-by=</option></term>
257 <term><option>x-systemd.required-by=</option></term>
258
259 <listitem><para>In the created mount unit, configures a <varname>WantedBy=</varname> or
260 <varname>RequiredBy=</varname> dependency on another unit. This option may be specified more than once.
261 If this is specified, the default dependencies (see above) other than <filename>umount.target</filename>
262 on the created mount unit, e.g. <filename>local-fs.target</filename>, are not automatically created.
263 Hence it is likely that some ordering dependencies need to be set up manually through
264 <option>x-systemd.before=</option> and <option>x-systemd.after=</option>. See <varname>WantedBy=</varname>
265 and <varname>RequiredBy=</varname> in
266 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
267 for details.</para>
268
269 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
270 </varlistentry>
271
272 <varlistentry>
273 <term><option>x-systemd.wants-mounts-for=</option></term>
274 <term><option>x-systemd.requires-mounts-for=</option></term>
275
276 <listitem><para>Configures a
277 <varname>RequiresMountsFor=</varname> or <varname>WantsMountsFor=</varname>
278 dependency between the created mount unit and other mount units. The
279 argument must be an absolute path. This option may be specified more than
280 once. See <varname>RequiresMountsFor=</varname> or <varname>WantsMountsFor=</varname> in
281 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
282 for details.</para>
283
284 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
285 </varlistentry>
286
287 <varlistentry>
288 <term><option>x-systemd.graceful-option=</option></term>
289
290 <listitem><para>Additional mount option that shall be appended if supported by the kernel.
291 This may be used to configure mount options that are optional and only enabled on kernels that
292 support them. Note that this is supported only for native kernel mount options (i.e. explicitly not
293 for mount options implemented in userspace, such as those processed by
294 <command>/usr/bin/mount</command> itself, by FUSE or by mount helpers such as
295 <command>mount.nfs</command>). This option may be specified more than once.</para>
296
297 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
298 </varlistentry>
299
300 <varlistentry>
301 <term><option>x-systemd.device-bound=</option></term>
302
303 <listitem><para>Takes a boolean argument. If true or no argument, a <varname>BindsTo=</varname> dependency
304 on the backing device is set. If false, the mount unit is not stopped no matter whether the backing device
305 is still present. This is useful when the file system is backed by volume managers. If not set, and the mount
306 comes from unit fragments, i.e. generated from <filename>/etc/fstab</filename> by <citerefentry>
307 <refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> or loaded from
308 a manually configured mount unit, a combination of <varname>Requires=</varname> and <varname>StopPropagatedFrom=</varname>
309 dependencies is set on the backing device, otherwise only <varname>Requires=</varname> is used.</para>
310
311 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
312 </varlistentry>
313
314 <varlistentry>
315 <term><option>x-systemd.automount</option></term>
316
317 <listitem><para>An automount unit will be created for the file
318 system. See
319 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
320 for details.</para>
321
322 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
323 </varlistentry>
324
325 <varlistentry>
326 <term><option>x-systemd.idle-timeout=</option></term>
327
328 <listitem><para>Configures the idle timeout of the
329 automount unit. See <varname>TimeoutIdleSec=</varname> in
330 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
331 for details.</para>
332
333 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
334 </varlistentry>
335
336 <varlistentry id='device-timeout'>
337 <term><option>x-systemd.device-timeout=</option></term>
338
339 <listitem><para>Configure how long systemd should wait for a
340 device to show up before giving up on an entry from
341 <filename>/etc/fstab</filename>. Specify a time in seconds or
342 explicitly append a unit such as <literal>s</literal>,
343 <literal>min</literal>, <literal>h</literal>,
344 <literal>ms</literal>.</para>
345
346 <para>Note that this option can only be used in
347 <filename>/etc/fstab</filename>, and will be
348 ignored when part of the <varname>Options=</varname>
349 setting in a unit file.</para>
350
351 <xi:include href="version-info.xml" xpointer="v215"/>
352 </listitem>
353 </varlistentry>
354
355 <varlistentry>
356 <term><option>x-systemd.mount-timeout=</option></term>
357
358 <listitem><para>Configure how long systemd should wait for the
359 mount command to finish before giving up on an entry from
360 <filename>/etc/fstab</filename>. Specify a time in seconds or
361 explicitly append a unit such as <literal>s</literal>,
362 <literal>min</literal>, <literal>h</literal>,
363 <literal>ms</literal>.</para>
364
365 <para>Note that this option can only be used in
366 <filename>/etc/fstab</filename>, and will be
367 ignored when part of the <varname>Options=</varname>
368 setting in a unit file.</para>
369
370 <para>See <varname>TimeoutSec=</varname> below for
371 details.</para>
372
373 <xi:include href="version-info.xml" xpointer="v233"/>
374 </listitem>
375 </varlistentry>
376
377 <varlistentry>
378 <term><option>x-systemd.makefs</option></term>
379
380 <listitem><para>The file system will be initialized
381 on the device. If the device is not "empty", i.e. it contains any signature,
382 the operation will be skipped. It is hence expected that this option
383 remains set even after the device has been initialized.</para>
384
385 <para>Note that this option can only be used in
386 <filename>/etc/fstab</filename>, and will be ignored when part of the
387 <varname>Options=</varname> setting in a unit file.</para>
388
389 <para>See
390 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
391 </para>
392
393 <para><citerefentry project='man-pages'><refentrytitle>wipefs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
394 may be used to remove any signatures from a block device to force
395 <option>x-systemd.makefs</option> to reinitialize the device.</para>
396
397 <xi:include href="version-info.xml" xpointer="v236"/>
398 </listitem>
399 </varlistentry>
400
401 <varlistentry>
402 <term><option>x-systemd.growfs</option></term>
403
404 <listitem><para>The file system will be grown to occupy the full block
405 device. If the file system is already at maximum size, no action will
406 be performed. It is hence expected that this option remains set even after
407 the file system has been grown. Only certain file system types are supported,
408 see
409 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry>
410 for details.</para>
411
412 <para>Note that this option can only be used in
413 <filename>/etc/fstab</filename>, and will be ignored when part of the
414 <varname>Options=</varname> setting in a unit file.</para>
415
416 <xi:include href="version-info.xml" xpointer="v236"/></listitem>
417 </varlistentry>
418
419 <varlistentry>
420 <term><option>x-systemd.pcrfs</option></term>
421
422 <listitem><para>Measures file system identity information (mount point, type, label, UUID, partition
423 label, partition UUID) into PCR 15 after the file system has been mounted. This ensures the
424 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry>
425 or <filename>systemd-pcrfs-root.service</filename> services are pulled in by the mount unit.</para>
426
427 <para>Note that this option can only be used in <filename>/etc/fstab</filename>, and will be ignored
428 when part of the <varname>Options=</varname> setting in a unit file. It is also implied for the root
429 and <filename>/usr/</filename> partitions discovered by
430 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
431
432 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
433 </varlistentry>
434
435 <varlistentry>
436 <term><option>x-systemd.validatefs</option></term>
437
438 <listitem><para>Validates mount constraint metadata of the mounted file system after mounting
439 it. This ensures the
440 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry>
441 service is pulled in by the mount unit.</para>
442
443 <para>Note that this option can only be used in <filename>/etc/fstab</filename>, and will be ignored
444 when part of the <varname>Options=</varname> setting in a unit file. It is also implied for all
445 partitions discovered by
446 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
447
448 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
449 </varlistentry>
450
451 <varlistentry>
452 <term><option>x-systemd.rw-only</option></term>
453
454 <listitem><para>If a mount operation fails to mount the file system
455 read-write, it normally tries mounting the file system read-only instead.
456 This option disables that behaviour, and causes the mount to fail
457 immediately instead. This option is translated into the
458 <varname>ReadWriteOnly=</varname> setting in a unit file.</para>
459
460 <xi:include href="version-info.xml" xpointer="v246"/>
461 </listitem>
462 </varlistentry>
463
464 <varlistentry>
465 <term><option>_netdev</option></term>
466
467 <listitem><para>Normally the file system type is used to determine if a
468 mount is a "network mount", i.e. if it should only be started after the
469 network is available. Using this option overrides this detection and
470 specifies that the mount requires network.</para>
471
472 <para>Network mount units are ordered between <filename>remote-fs-pre.target</filename>
473 and <filename>remote-fs.target</filename>, instead of
474 <filename>local-fs-pre.target</filename> and <filename>local-fs.target</filename>.
475 They also pull in <filename>network-online.target</filename> and are ordered after
476 it and <filename>network.target</filename>.</para>
477
478 <xi:include href="version-info.xml" xpointer="v235"/>
479 </listitem>
480 </varlistentry>
481
482 <varlistentry>
483 <term><option>noauto</option></term>
484 <term><option>auto</option></term>
485
486 <listitem><para>With <option>noauto</option>, the mount unit will not be added as a dependency for
487 <filename>local-fs.target</filename> or <filename>remote-fs.target</filename>. This means that it
488 will not be mounted automatically during boot, unless it is pulled in by some other unit. The
489 <option>auto</option> option has the opposite meaning and is the default.</para>
490
491 <para>Note that if <option>x-systemd.automount</option> (see above) is used, neither
492 <option>auto</option> nor <option>noauto</option> have any effect. The matching automount unit will
493 be added as a dependency to the appropriate target.</para>
494
495 <xi:include href="version-info.xml" xpointer="v215"/>
496 </listitem>
497 </varlistentry>
498
499 <varlistentry>
500 <term><option>nofail</option></term>
501
502 <listitem><para>With <option>nofail</option>, this mount will be only wanted, not required, by
503 <filename>local-fs.target</filename> or <filename>remote-fs.target</filename>. Moreover, the mount unit is not
504 ordered before these target units. This means that the boot will continue without waiting for the mount unit
505 and regardless whether the mount point can be mounted successfully.</para>
506
507 <xi:include href="version-info.xml" xpointer="v215"/>
508 </listitem>
509 </varlistentry>
510
511 <varlistentry>
512 <term><option>x-initrd.mount</option></term>
513
514 <listitem><para>An additional filesystem to be mounted in the initrd. See
515 <filename>initrd-fs.target</filename> description in
516 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>. This
517 is both an indicator to the initrd to mount this partition early and an indicator to the host to
518 leave the partition mounted until final shutdown. Or in other words, if this flag is set it is
519 assumed the mount shall be active during the entire regular runtime of the system, i.e. established
520 before the initrd transitions into the host all the way until the host transitions to the final
521 shutdown phase.</para>
522
523 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
524 </varlistentry>
525 </variablelist>
526
527 <para>If a mount point is configured in both
528 <filename>/etc/fstab</filename> and a unit file that is stored
529 below <filename>/usr/</filename>, the former will take precedence.
530 If the unit file is stored below <filename>/etc/</filename>, it
531 will take precedence. This means: native unit files take
532 precedence over traditional configuration files, but this is
533 superseded by the rule that configuration in
534 <filename>/etc/</filename> will always take precedence over
535 configuration in <filename>/usr/</filename>.</para>
536 </refsect1>
537
538 <refsect1>
539 <title>Options</title>
540
541 <para>Mount unit files may include [Unit] and [Install] sections, which are described in
542 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
543 </para>
544
545 <para>Mount unit files must include a [Mount] section, which carries
546 information about the file system mount points it supervises. A
547 number of options that may be used in this section are shared with
548 other unit types. These options are documented in
549 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
550 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry> and
551 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
552 The options specific to the [Mount] section of mount units are the
553 following:</para>
554
555 <variablelist class='unit-directives'>
556
557 <varlistentry>
558 <term><varname>What=</varname></term>
559 <listitem><para>Takes an absolute path or a fstab-style identifier of a device node, file or
560 other resource to mount. See <citerefentry
561 project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> for
562 details. If this refers to a device node, a dependency on the respective device unit is automatically
563 created. (See
564 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
565 for more information.) This option is mandatory. Note that the usual specifier expansion is applied
566 to this setting, literal percent characters should hence be written as <literal
567 class='specifiers'>%%</literal>. If this mount is a bind mount and the specified path does not exist
568 yet it is created as directory.</para></listitem>
569 </varlistentry>
570
571 <varlistentry>
572 <term><varname>Where=</varname></term>
573 <listitem><para>Takes an absolute path of a file or directory for the mount point; in particular, the
574 destination cannot be a symbolic link. If the mount point does not exist at the time of mounting, it
575 is created as either a directory or a file. The former is the usual case; the latter is done only if this mount
576 is a bind mount and the source (<varname>What=</varname>) is not a directory.
577 This string must be reflected in the unit filename. (See above.) This option
578 is mandatory.</para></listitem>
579 </varlistentry>
580
581 <varlistentry>
582 <term><varname>Type=</varname></term>
583 <listitem><para>Takes a string for the file system type. See
584 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
585 for details. This setting is optional.</para>
586
587 <para>If the type is <literal>overlay</literal>, and <literal>upperdir=</literal> or
588 <literal>workdir=</literal> are specified as options and the directories do not exist, they will be created.
589 </para></listitem>
590 </varlistentry>
591
592 <varlistentry>
593 <term><varname>Options=</varname></term>
594
595 <listitem><para>Mount options to use when mounting. This takes a comma-separated list of options. This setting
596 is optional. Note that the usual specifier expansion is applied to this setting, literal percent characters
597 should hence be written as <literal class='specifiers'>%%</literal>.</para></listitem>
598 </varlistentry>
599
600 <varlistentry>
601 <term><varname>SloppyOptions=</varname></term>
602
603 <listitem><para>Takes a boolean argument. If true, parsing of
604 the options specified in <varname>Options=</varname> is
605 relaxed, and unknown mount options are tolerated. This
606 corresponds with
607 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
608 <parameter>-s</parameter> switch. Defaults to
609 off.</para>
610
611 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
612 </varlistentry>
613
614 <varlistentry>
615 <term><varname>LazyUnmount=</varname></term>
616
617 <listitem><para>Takes a boolean argument. If true, detach the
618 filesystem from the filesystem hierarchy at time of the unmount
619 operation, and clean up all references to the filesystem as
620 soon as they are not busy anymore.
621 This corresponds with
622 <citerefentry project='man-pages'><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
623 <parameter>-l</parameter> switch. Defaults to
624 off.</para>
625
626 <xi:include href="version-info.xml" xpointer="v232"/></listitem>
627 </varlistentry>
628
629 <varlistentry>
630 <term><varname>ReadWriteOnly=</varname></term>
631
632 <listitem><para>Takes a boolean argument. If false, a mount
633 point that shall be mounted read-write but cannot be mounted
634 so is retried to be mounted read-only. If true the operation
635 will fail immediately after the read-write mount attempt did
636 not succeed. This corresponds with
637 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
638 <parameter>-w</parameter> switch. Defaults to
639 off.</para>
640
641 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
642 </varlistentry>
643
644 <varlistentry>
645 <term><varname>ForceUnmount=</varname></term>
646
647 <listitem><para>Takes a boolean argument. If true, force an
648 unmount (in case of an unreachable NFS system).
649 This corresponds with
650 <citerefentry project='man-pages'><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
651 <parameter>-f</parameter> switch. Defaults to
652 off.</para>
653
654 <xi:include href="version-info.xml" xpointer="v232"/></listitem>
655 </varlistentry>
656
657 <varlistentry>
658 <term><varname>DirectoryMode=</varname></term>
659 <listitem><para>Directories of mount points (and any parent
660 directories) are automatically created if needed. This option
661 specifies the file system access mode used when creating these
662 directories. Takes an access mode in octal notation. Defaults
663 to 0755.</para></listitem>
664 </varlistentry>
665
666 <varlistentry>
667 <term><varname>TimeoutSec=</varname></term>
668 <listitem><para>Configures the time to wait for the mount
669 command to finish. If a command does not exit within the
670 configured time, the mount will be considered failed and be
671 shut down again. All commands still running will be terminated
672 forcibly via <constant>SIGTERM</constant>, and after another
673 delay of this time with <constant>SIGKILL</constant>. (See
674 <option>KillMode=</option> in
675 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
676 Takes a unit-less value in seconds, or a time span value such
677 as "5min 20s". Pass 0 to disable the timeout logic. The
678 default value is set from <varname>DefaultTimeoutStartSec=</varname> option in
679 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
680 </para></listitem>
681 </varlistentry>
682 </variablelist>
683
684 <xi:include href="systemd.service.xml" xpointer="shared-unit-options" />
685 </refsect1>
686
687 <refsect1>
688 <title>See Also</title>
689 <para><simplelist type="inline">
690 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
691 <member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
692 <member><citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
693 <member><citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
694 <member><citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
695 <member><citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
696 <member><citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
697 <member><citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
698 <member><citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
699 <member><citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
700 <member><citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
701 <member><citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
702 <member><citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
703 <member><citerefentry><refentrytitle>systemd-mount</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
704 </simplelist></para>
705 </refsect1>
706
707 </refentry>