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+ -->
6 <refentry id=
"systemd.mount">
8 <title>systemd.mount
</title>
9 <productname>systemd
</productname>
13 <refentrytitle>systemd.mount
</refentrytitle>
14 <manvolnum>5</manvolnum>
18 <refname>systemd.mount
</refname>
19 <refpurpose>Mount unit configuration
</refpurpose>
23 <para><filename><replaceable>mount
</replaceable>.mount
</filename></para>
27 <title>Description
</title>
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>
33 <para>This man page lists the configuration options specific to
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
<literal>[Unit]
</literal> and
38 <literal>[Install]
</literal> sections. The mount specific configuration options are
39 configured in the
<literal>[Mount]
</literal> section.
</para>
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
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>
62 <para>Mount units must be named after the mount point directories they control. Example: the mount point
<filename
63 index=
"false">/home/lennart
</filename> must be configured in a unit file
<filename>home-lennart.mount
</filename>.
64 For details about the escaping logic used to convert a file system path to a unit name, see
65 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Note that mount
66 units cannot be templated, nor is possible to add multiple names to a mount unit by creating additional symlinks to
69 <para>Optionally, a mount unit may be accompanied by an automount
70 unit, to allow on-demand or parallelized mounting. See
71 <citerefentry><refentrytitle>systemd.automount
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para>
73 <para>Mount points created at runtime (independently of unit files
74 or
<filename>/etc/fstab
</filename>) will be monitored by systemd
75 and appear like any other mount unit in systemd. See
76 <filename>/proc/self/mountinfo
</filename> description in
77 <citerefentry project='man-pages'
><refentrytitle>proc
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
80 <para>Some file systems have special semantics as API file systems
81 for kernel-to-userspace and userspace-to-userspace interfaces. Some
82 of them may not be changed via mount units, and cannot be
83 disabled. For a longer discussion see
<ulink
84 url=
"https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems">API
85 File Systems
</ulink>.
</para>
88 <citerefentry><refentrytitle>systemd-mount
</refentrytitle><manvolnum>1</manvolnum></citerefentry> command
89 allows creating
<filename>.mount
</filename> and
<filename>.automount
</filename> units dynamically and
90 transiently from the command line.
</para>
94 <title>Automatic Dependencies
</title>
97 <title>Implicit Dependencies
</title>
99 <para>The following dependencies are implicitly added:
</para>
102 <listitem><para>If a mount unit is beneath another mount unit in the file
103 system hierarchy, both a requirement dependency and an ordering
104 dependency between both units are created automatically.
</para></listitem>
106 <listitem><para>Block device backed file systems automatically gain
107 <varname>BindsTo=
</varname> and
<varname>After=
</varname> type
108 dependencies on the device unit encapsulating the block
109 device (see below).
</para></listitem>
111 <listitem><para>If traditional file system quota is enabled for a mount
112 unit, automatic
<varname>Wants=
</varname> and
113 <varname>Before=
</varname> dependencies on
114 <filename>systemd-quotacheck.service
</filename> and
115 <filename>quotaon.service
</filename> are added.
</para></listitem>
117 <listitem><para>Additional implicit dependencies may be added as result of
118 execution and resource control parameters as documented in
119 <citerefentry><refentrytitle>systemd.exec
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
121 <citerefentry><refentrytitle>systemd.resource-control
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
127 <title>Default Dependencies
</title>
129 <para>The following dependencies are added unless
<varname>DefaultDependencies=no
</varname> is set:
</para>
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>
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
138 <option>nofail
</option> mount option is set.
</para></listitem>
140 <listitem><para>Network mount units
141 automatically acquire
<varname>After=
</varname> dependencies on
<filename>remote-fs-pre.target
</filename>,
142 <filename>network.target
</filename> and
<filename>network-online.target
</filename>, and gain a
143 <varname>Before=
</varname> dependency on
<filename>remote-fs.target
</filename> unless
144 <option>nofail
</option> mount option is set. Towards the latter a
145 <varname>Wants=
</varname> unit is added as well.
</para></listitem>
148 <para>Mount units referring to local and network file systems are distinguished by their file system type
149 specification. In some cases this is not sufficient (for example network block device based mounts, such as
150 iSCSI), in which case
<option>_netdev
</option> may be added to the mount option string of the unit, which forces
151 systemd to consider the mount unit a network mount.
</para>
156 <title><filename>fstab
</filename></title>
158 <para>Mount units may either be configured via unit files, or via
159 <filename>/etc/fstab
</filename> (see
160 <citerefentry project='man-pages'
><refentrytitle>fstab
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
161 for details). Mounts listed in
<filename>/etc/fstab
</filename>
162 will be converted into native units dynamically at boot and when
163 the configuration of the system manager is reloaded. In general,
164 configuring mount points through
<filename>/etc/fstab
</filename>
165 is the preferred approach. See
166 <citerefentry><refentrytitle>systemd-fstab-generator
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
167 for details about the conversion.
</para>
169 <para>The NFS mount option
<option>bg
</option> for NFS background mounts
170 as documented in
<citerefentry project='man-pages'
><refentrytitle>nfs
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
171 is detected by
<command>systemd-fstab-generator
</command> and the options
172 are transformed so that systemd fulfills the job-control implications of
173 that option. Specifically
<command>systemd-fstab-generator
</command> acts
174 as though
<literal>x-systemd.mount-timeout=infinity,retry=
10000</literal> was
175 prepended to the option list, and
<literal>fg,nofail
</literal> was appended.
176 Depending on specific requirements, it may be appropriate to provide some of
177 these options explicitly, or to make use of the
178 <literal>x-systemd.automount
</literal> option described below instead
179 of using
<literal>bg
</literal>.
</para>
181 <para>When reading
<filename>/etc/fstab
</filename> a few special
182 mount options are understood by systemd which influence how
183 dependencies are created for mount points. systemd will create a
184 dependency of type
<varname>Wants=
</varname> or
185 <option>Requires=
</option> (see option
<option>nofail
</option>
186 below), from either
<filename>local-fs.target
</filename> or
187 <filename>remote-fs.target
</filename>, depending whether the file
188 system is local or remote.
</para>
190 <variablelist class='fstab-options'
>
193 <term><option>x-systemd.requires=
</option></term>
195 <listitem><para>Configures a
<varname>Requires=
</varname> and
196 an
<varname>After=
</varname> dependency between the created
197 mount unit and another systemd unit, such as a device or mount
198 unit. The argument should be a unit name, or an absolute path
199 to a device node or mount point. This option may be specified
200 more than once. This option is particularly useful for mount
201 point declarations that need an additional device to be around
202 (such as an external journal device for journal file systems)
203 or an additional mount to be in place (such as an overlay file
204 system that merges multiple mount points). See
205 <varname>After=
</varname> and
<varname>Requires=
</varname> in
206 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
207 for details.
</para></listitem>
211 <term><option>x-systemd.before=
</option></term>
212 <term><option>x-systemd.after=
</option></term>
214 <listitem><para>Configures a
<varname>Before=
</varname>
215 dependency or
<varname>After=
</varname> between the created
216 mount unit and another systemd unit, such as a mount unit.
217 The argument should be a unit name or an absolute path
218 to a mount point. This option may be specified more than once.
219 This option is particularly useful for mount point declarations
220 with
<option>nofail
</option> option that are mounted
221 asynchronously but need to be mounted before or after some unit
222 start, for example, before
<filename>local-fs.target
</filename>
224 See
<varname>Before=
</varname> and
<varname>After=
</varname> in
225 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
226 for details.
</para></listitem>
230 <term><option>x-systemd.requires-mounts-for=
</option></term>
232 <listitem><para>Configures a
233 <varname>RequiresMountsFor=
</varname> dependency between the
234 created mount unit and other mount units. The argument must be
235 an absolute path. This option may be specified more than once.
236 See
<varname>RequiresMountsFor=
</varname> in
237 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
238 for details.
</para></listitem>
242 <term><option>x-systemd.device-bound
</option></term>
244 <listitem><para>The block device backed file system will be upgraded
245 to
<varname>BindsTo=
</varname> dependency. This option is only useful
246 when mounting file systems manually with
247 <citerefentry project='man-pages'
><refentrytitle>mount
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
248 as the default dependency in this case is
<varname>Requires=
</varname>.
249 This option is already implied by entries in
<filename>/etc/fstab
</filename>
255 <term><option>x-systemd.automount
</option></term>
257 <listitem><para>An automount unit will be created for the file
259 <citerefentry><refentrytitle>systemd.automount
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
260 for details.
</para></listitem>
264 <term><option>x-systemd.idle-timeout=
</option></term>
266 <listitem><para>Configures the idle timeout of the
267 automount unit. See
<varname>TimeoutIdleSec=
</varname> in
268 <citerefentry><refentrytitle>systemd.automount
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
269 for details.
</para></listitem>
272 <varlistentry id='device-timeout'
>
273 <term><option>x-systemd.device-timeout=
</option></term>
275 <listitem><para>Configure how long systemd should wait for a
276 device to show up before giving up on an entry from
277 <filename>/etc/fstab
</filename>. Specify a time in seconds or
278 explicitly append a unit such as
<literal>s
</literal>,
279 <literal>min
</literal>,
<literal>h
</literal>,
280 <literal>ms
</literal>.
</para>
282 <para>Note that this option can only be used in
283 <filename>/etc/fstab
</filename>, and will be
284 ignored when part of the
<varname>Options=
</varname>
285 setting in a unit file.
</para>
290 <term><option>x-systemd.mount-timeout=
</option></term>
292 <listitem><para>Configure how long systemd should wait for the
293 mount command to finish before giving up on an entry from
294 <filename>/etc/fstab
</filename>. Specify a time in seconds or
295 explicitly append a unit such as
<literal>s
</literal>,
296 <literal>min
</literal>,
<literal>h
</literal>,
297 <literal>ms
</literal>.
</para>
299 <para>Note that this option can only be used in
300 <filename>/etc/fstab
</filename>, and will be
301 ignored when part of the
<varname>Options=
</varname>
302 setting in a unit file.
</para>
304 <para>See
<varname>TimeoutSec=
</varname> below for
310 <term><option>x-systemd.makefs
</option></term>
312 <listitem><para>The file system will be initialized
313 on the device. If the device is not
"empty", i.e. it contains any signature,
314 the operation will be skipped. It is hence expected that this option
315 remains set even after the device has been initialized.
</para>
317 <para>Note that this option can only be used in
318 <filename>/etc/fstab
</filename>, and will be ignored when part of the
319 <varname>Options=
</varname> setting in a unit file.
</para>
322 <citerefentry><refentrytitle>systemd-makefs@.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
325 <para><citerefentry project='man-pages'
><refentrytitle>wipefs
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
326 may be used to remove any signatures from a block device to force
327 <option>x-systemd.makefs
</option> to reinitialize the device.
</para>
332 <term><option>x-systemd.growfs
</option></term>
334 <listitem><para>The file system will be grown to occupy the full block
335 device. If the file system is already at maximum size, no action will
336 be performed. It is hence expected that this option remains set even after
337 the file system has been grown. Only certain file system types are supported,
339 <citerefentry><refentrytitle>systemd-makefs@.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
342 <para>Note that this option can only be used in
343 <filename>/etc/fstab
</filename>, and will be ignored when part of the
344 <varname>Options=
</varname> setting in a unit file.
</para></listitem>
348 <term><option>_netdev
</option></term>
350 <listitem><para>Normally the file system type is used to determine if a
351 mount is a
"network mount", i.e. if it should only be started after the
352 network is available. Using this option overrides this detection and
353 specifies that the mount requires network.
</para>
355 <para>Network mount units are ordered between
<filename>remote-fs-pre.target
</filename>
356 and
<filename>remote-fs.target
</filename>, instead of
357 <filename>local-fs-pre.target
</filename> and
<filename>local-fs.target
</filename>.
358 They also pull in
<filename>network-online.target
</filename> and are ordered after
359 it and
<filename>network.target
</filename>.
</para>
364 <term><option>noauto
</option></term>
365 <term><option>auto
</option></term>
367 <listitem><para>With
<option>noauto
</option>, the mount unit will not be added as a dependency for
368 <filename>local-fs.target
</filename> or
<filename>remote-fs.target
</filename>. This means that it will not be
369 mounted automatically during boot, unless it is pulled in by some other unit. The
<option>auto
</option> option
370 has the opposite meaning and is the default. Note that the
<option>noauto
</option> option has an effect on the
371 mount unit itself only — if
<option>x-systemd.automount
</option> is used (see above), then the matching
372 automount unit will still be pulled in by these targets.
</para>
377 <term><option>nofail
</option></term>
379 <listitem><para>With
<option>nofail
</option>, this mount will be only wanted, not required, by
380 <filename>local-fs.target
</filename> or
<filename>remote-fs.target
</filename>. Moreover the mount unit is not
381 ordered before these target units. This means that the boot will continue without waiting for the mount unit
382 and regardless whether the mount point can be mounted successfully.
</para>
387 <term><option>x-initrd.mount
</option></term>
389 <listitem><para>An additional filesystem to be mounted in the
390 initramfs. See
<filename>initrd-fs.target
</filename>
392 <citerefentry><refentrytitle>systemd.special
</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
397 <para>If a mount point is configured in both
398 <filename>/etc/fstab
</filename> and a unit file that is stored
399 below
<filename>/usr
</filename>, the former will take precedence.
400 If the unit file is stored below
<filename>/etc
</filename>, it
401 will take precedence. This means: native unit files take
402 precedence over traditional configuration files, but this is
403 superseded by the rule that configuration in
404 <filename>/etc
</filename> will always take precedence over
405 configuration in
<filename>/usr
</filename>.
</para>
409 <title>Options
</title>
411 <para>Mount files must include a [Mount] section, which carries
412 information about the file system mount points it supervises. A
413 number of options that may be used in this section are shared with
414 other unit types. These options are documented in
415 <citerefentry><refentrytitle>systemd.exec
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
417 <citerefentry><refentrytitle>systemd.kill
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
418 The options specific to the [Mount] section of mount units are the
421 <variablelist class='unit-directives'
>
424 <term><varname>What=
</varname></term>
425 <listitem><para>Takes an absolute path of a device node, file or other resource to mount. See
<citerefentry
426 project='man-pages'
><refentrytitle>mount
</refentrytitle><manvolnum>8</manvolnum></citerefentry> for details. If
427 this refers to a device node, a dependency on the respective device unit is automatically created. (See
428 <citerefentry><refentrytitle>systemd.device
</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more
429 information.) This option is mandatory. Note that the usual specifier expansion is applied to this setting,
430 literal percent characters should hence be written as
<literal>%%
</literal>.
</para></listitem>
434 <term><varname>Where=
</varname></term>
435 <listitem><para>Takes an absolute path of a directory for the
436 mount point; in particular, the destination cannot be a symbolic
437 link. If the mount point does not exist at the time of
438 mounting, it is created. This string must be reflected in the
439 unit filename. (See above.) This option is
440 mandatory.
</para></listitem>
444 <term><varname>Type=
</varname></term>
445 <listitem><para>Takes a string for the file system type. See
446 <citerefentry project='man-pages'
><refentrytitle>mount
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
447 for details. This setting is optional.
</para></listitem>
451 <term><varname>Options=
</varname></term>
453 <listitem><para>Mount options to use when mounting. This takes a comma-separated list of options. This setting
454 is optional. Note that the usual specifier expansion is applied to this setting, literal percent characters
455 should hence be written as
<literal>%%
</literal>.
</para></listitem>
459 <term><varname>SloppyOptions=
</varname></term>
461 <listitem><para>Takes a boolean argument. If true, parsing of
462 the options specified in
<varname>Options=
</varname> is
463 relaxed, and unknown mount options are tolerated. This
465 <citerefentry project='man-pages'
><refentrytitle>mount
</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
466 <parameter>-s
</parameter> switch. Defaults to
467 off.
</para></listitem>
471 <term><varname>LazyUnmount=
</varname></term>
473 <listitem><para>Takes a boolean argument. If true, detach the
474 filesystem from the filesystem hierarchy at time of the unmount
475 operation, and clean up all references to the filesystem as
476 soon as they are not busy anymore.
477 This corresponds with
478 <citerefentry project='man-pages'
><refentrytitle>umount
</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
479 <parameter>-l
</parameter> switch. Defaults to
480 off.
</para></listitem>
484 <term><varname>ForceUnmount=
</varname></term>
486 <listitem><para>Takes a boolean argument. If true, force an
487 unmount (in case of an unreachable NFS system).
488 This corresponds with
489 <citerefentry project='man-pages'
><refentrytitle>umount
</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
490 <parameter>-f
</parameter> switch. Defaults to
491 off.
</para></listitem>
495 <term><varname>DirectoryMode=
</varname></term>
496 <listitem><para>Directories of mount points (and any parent
497 directories) are automatically created if needed. This option
498 specifies the file system access mode used when creating these
499 directories. Takes an access mode in octal notation. Defaults
500 to
0755.
</para></listitem>
504 <term><varname>TimeoutSec=
</varname></term>
505 <listitem><para>Configures the time to wait for the mount
506 command to finish. If a command does not exit within the
507 configured time, the mount will be considered failed and be
508 shut down again. All commands still running will be terminated
509 forcibly via
<constant>SIGTERM
</constant>, and after another
510 delay of this time with
<constant>SIGKILL
</constant>. (See
511 <option>KillMode=
</option> in
512 <citerefentry><refentrytitle>systemd.kill
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
513 Takes a unit-less value in seconds, or a time span value such
514 as
"5min 20s". Pass
0 to disable the timeout logic. The
515 default value is set from
<varname>DefaultTimeoutStartSec=
</varname> option in
516 <citerefentry><refentrytitle>systemd-system.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
522 <citerefentry><refentrytitle>systemd.exec
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
524 <citerefentry><refentrytitle>systemd.kill
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
525 for more settings.
</para>
529 <title>See Also
</title>
531 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
532 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
533 <citerefentry><refentrytitle>systemd-system.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
534 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
535 <citerefentry><refentrytitle>systemd.exec
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
536 <citerefentry><refentrytitle>systemd.kill
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
537 <citerefentry><refentrytitle>systemd.resource-control
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
538 <citerefentry><refentrytitle>systemd.service
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
539 <citerefentry><refentrytitle>systemd.device
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
540 <citerefentry project='man-pages'
><refentrytitle>proc
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
541 <citerefentry project='man-pages'
><refentrytitle>mount
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
542 <citerefentry><refentrytitle>systemd-fstab-generator
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
543 <citerefentry><refentrytitle>systemd.directives
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
544 <citerefentry><refentrytitle>systemd-mount
</refentrytitle><manvolnum>1</manvolnum></citerefentry>