]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.mount.xml
man/systemd.mount: tmpfs automatically gains After=swap.target dep
[thirdparty/systemd.git] / man / systemd.mount.xml
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.2/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://www.freedesktop.org/wiki/Software/systemd/APIFileSystems">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>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
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.before=</option></term>
221 <term><option>x-systemd.after=</option></term>
222
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.
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>
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
239 specified.</para>
240
241 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
242 </varlistentry>
243
244 <varlistentry>
245 <term><option>x-systemd.wanted-by=</option></term>
246 <term><option>x-systemd.required-by=</option></term>
247
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
255 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
256 for details.</para>
257
258 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
259 </varlistentry>
260
261 <varlistentry>
262 <term><option>x-systemd.wants-mounts-for=</option></term>
263 <term><option>x-systemd.requires-mounts-for=</option></term>
264
265 <listitem><para>Configures a
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
270 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
271 for details.</para>
272
273 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
274 </varlistentry>
275
276 <varlistentry>
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>
286
287 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
288 </varlistentry>
289
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>
296 for details.</para>
297
298 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
299 </varlistentry>
300
301 <varlistentry>
302 <term><option>x-systemd.idle-timeout=</option></term>
303
304 <listitem><para>Configures the idle timeout of the
305 automount unit. See <varname>TimeoutIdleSec=</varname> in
306 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
307 for details.</para>
308
309 <xi:include href="version-info.xml" xpointer="v220"/></listitem>
310 </varlistentry>
311
312 <varlistentry id='device-timeout'>
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
318 explicitly append a unit such as <literal>s</literal>,
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
324 ignored when part of the <varname>Options=</varname>
325 setting in a unit file.</para>
326
327 <xi:include href="version-info.xml" xpointer="v215"/>
328 </listitem>
329 </varlistentry>
330
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>
348
349 <xi:include href="version-info.xml" xpointer="v233"/>
350 </listitem>
351 </varlistentry>
352
353 <varlistentry>
354 <term><option>x-systemd.makefs</option></term>
355
356 <listitem><para>The file system will be initialized
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
359 remains set even after the device has been initialized.</para>
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>
372
373 <xi:include href="version-info.xml" xpointer="v236"/>
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
390 <varname>Options=</varname> setting in a unit file.</para>
391
392 <xi:include href="version-info.xml" xpointer="v236"/></listitem>
393 </varlistentry>
394
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
405 and <filename>/usr/</filename> partitions discovered by
406 <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
407
408 <xi:include href="version-info.xml" xpointer="v253"/></listitem>
409 </varlistentry>
410
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>
419
420 <xi:include href="version-info.xml" xpointer="v246"/>
421 </listitem>
422 </varlistentry>
423
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>
437
438 <xi:include href="version-info.xml" xpointer="v235"/>
439 </listitem>
440 </varlistentry>
441
442 <varlistentry>
443 <term><option>noauto</option></term>
444 <term><option>auto</option></term>
445
446 <listitem><para>With <option>noauto</option>, the mount unit will not be added as a dependency for
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>
454
455 <xi:include href="version-info.xml" xpointer="v215"/>
456 </listitem>
457 </varlistentry>
458
459 <varlistentry>
460 <term><option>nofail</option></term>
461
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>
466
467 <xi:include href="version-info.xml" xpointer="v215"/>
468 </listitem>
469 </varlistentry>
470
471 <varlistentry>
472 <term><option>x-initrd.mount</option></term>
473
474 <listitem><para>An additional filesystem to be mounted in the initrd. See
475 <filename>initrd-fs.target</filename> description in
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
481 shutdown phase.</para>
482
483 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
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
489 below <filename>/usr/</filename>, the former will take precedence.
490 If the unit file is stored below <filename>/etc/</filename>, it
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
494 <filename>/etc/</filename> will always take precedence over
495 configuration in <filename>/usr/</filename>.</para>
496 </refsect1>
497
498 <refsect1>
499 <title>Options</title>
500
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
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>
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
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>
529 </varlistentry>
530
531 <varlistentry>
532 <term><varname>Where=</varname></term>
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
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
538 is mandatory.</para></listitem>
539 </varlistentry>
540
541 <varlistentry>
542 <term><varname>Type=</varname></term>
543 <listitem><para>Takes a string for the file system type. See
544 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
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>
550 </varlistentry>
551
552 <varlistentry>
553 <term><varname>Options=</varname></term>
554
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
557 should hence be written as <literal class='specifiers'>%%</literal>.</para></listitem>
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
567 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
568 <parameter>-s</parameter> switch. Defaults to
569 off.</para>
570
571 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
572 </varlistentry>
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
584 off.</para>
585
586 <xi:include href="version-info.xml" xpointer="v232"/></listitem>
587 </varlistentry>
588
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
599 off.</para>
600
601 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
602 </varlistentry>
603
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
612 off.</para>
613
614 <xi:include href="version-info.xml" xpointer="v232"/></listitem>
615 </varlistentry>
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
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>
641 </varlistentry>
642 </variablelist>
643
644 <xi:include href="systemd.service.xml" xpointer="shared-unit-options" />
645 </refsect1>
646
647 <refsect1>
648 <title>See Also</title>
649 <para>
650 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
651 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
652 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
653 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
654 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
655 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
656 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
657 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
658 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
659 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
660 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
661 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
662 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
663 <citerefentry><refentrytitle>systemd-mount</refentrytitle><manvolnum>1</manvolnum></citerefentry>
664 </para>
665 </refsect1>
666
667 </refentry>