]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.mount.xml
bootctl: fix typo (#4897)
[thirdparty/systemd.git] / man / systemd.mount.xml
CommitLineData
cdb788e4 1<?xml version='1.0'?> <!--*-nxml-*-->
cdb788e4 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
cdb788e4
LP
4
5<!--
6 This file is part of systemd.
7
8 Copyright 2010 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
cdb788e4
LP
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 18 Lesser General Public License for more details.
cdb788e4 19
5430f7f2 20 You should have received a copy of the GNU Lesser General Public License
cdb788e4
LP
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22-->
23
24<refentry id="systemd.mount">
798d3a52
ZJS
25 <refentryinfo>
26 <title>systemd.mount</title>
27 <productname>systemd</productname>
28
29 <authorgroup>
30 <author>
31 <contrib>Developer</contrib>
32 <firstname>Lennart</firstname>
33 <surname>Poettering</surname>
34 <email>lennart@poettering.net</email>
35 </author>
36 </authorgroup>
37 </refentryinfo>
38
39 <refmeta>
40 <refentrytitle>systemd.mount</refentrytitle>
41 <manvolnum>5</manvolnum>
42 </refmeta>
43
44 <refnamediv>
45 <refname>systemd.mount</refname>
46 <refpurpose>Mount unit configuration</refpurpose>
47 </refnamediv>
48
49 <refsynopsisdiv>
50 <para><filename><replaceable>mount</replaceable>.mount</filename></para>
51 </refsynopsisdiv>
52
53 <refsect1>
54 <title>Description</title>
55
56 <para>A unit configuration file whose name ends in
57 <literal>.mount</literal> encodes information about a file system
58 mount point controlled and supervised by systemd.</para>
59
60 <para>This man page lists the configuration options specific to
61 this unit type. See
62 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
63 for the common options of all unit configuration files. The common
64 configuration items are configured in the generic [Unit] and
65 [Install] sections. The mount specific configuration options are
66 configured in the [Mount] section.</para>
67
68 <para>Additional options are listed in
69 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
70 which define the execution environment the
3ba3a79d 71 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
72 binary is executed in, and in
73 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
74 which define the way the processes are terminated, and in
75 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
76 which configure resource control settings for the processes of the
77 service. Note that the User= and Group= options are not
78 particularly useful for mount units specifying a
79 <literal>Type=</literal> option or using configuration not
80 specified in <filename>/etc/fstab</filename>;
3ba3a79d 81 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
82 will refuse options that are not listed in
83 <filename>/etc/fstab</filename> if it is not run as UID 0.</para>
84
f4bf8d2f
LP
85 <para>Mount units must be named after the mount point directories they control. Example: the mount point <filename
86 noindex='true'>/home/lennart</filename> must be configured in a unit file <filename>home-lennart.mount</filename>.
87 For details about the escaping logic used to convert a file system path to a unit name, see
88 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Note that mount
89 units cannot be templated, nor is possible to add multiple names to a mount unit by creating additional symlinks to
90 it.</para>
798d3a52
ZJS
91
92 <para>Optionally, a mount unit may be accompanied by an automount
93 unit, to allow on-demand or parallelized mounting. See
94 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
95
798d3a52
ZJS
96 <para>Mount points created at runtime (independently of unit files
97 or <filename>/etc/fstab</filename>) will be monitored by systemd
98 and appear like any other mount unit in systemd. See
99 <filename>/proc/self/mountinfo</filename> description in
100 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
101 </para>
102
103 <para>Some file systems have special semantics as API file systems
ff9b60f3 104 for kernel-to-userspace and userspace-to-userspace interfaces. Some
798d3a52
ZJS
105 of them may not be changed via mount units, and cannot be
106 disabled. For a longer discussion see <ulink
107 url="http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems">API
108 File Systems</ulink>.</para>
109 </refsect1>
110
c129bd5d
LP
111 <refsect1>
112 <title>Automatic Dependencies</title>
113
114 <para>If a mount unit is beneath another mount unit in the file
115 system hierarchy, both a requirement dependency and an ordering
116 dependency between both units are created automatically.</para>
117
118 <para>Block device backed file systems automatically gain
119 <varname>BindsTo=</varname> and <varname>After=</varname> type
120 dependencies on the device unit encapsulating the block
121 device (see below).</para>
122
123 <para>If traditional file system quota is enabled for a mount
124 unit, automatic <varname>Wants=</varname> and
125 <varname>Before=</varname> dependencies on
126 <filename>systemd-quotacheck.service</filename> and
127 <filename>quotaon.service</filename> are added.</para>
128
cc4e4df4
LP
129 <para>For mount units with <varname>DefaultDependencies=yes</varname> in the <literal>[Unit]</literal> section (the
130 default) a couple additional dependencies are added. Mount units referring to local file systems automatically gain
131 an <varname>After=</varname> dependency on <filename>local-fs-pre.target</filename>. Network mount units
132 automatically acquire <varname>After=</varname> dependencies on <filename>remote-fs-pre.target</filename>,
133 <filename>network.target</filename> and <filename>network-online.target</filename>. Towards the latter a
134 <varname>Wants=</varname> unit is added as well. Mount units referring to local and network file systems are
135 distinguished by their file system type specification. In some cases this is not sufficient (for example network
136 block device based mounts, such as iSCSI), in which case <option>_netdev</option> may be added to the mount option
137 string of the unit, which forces systemd to consider the mount unit a network mount. Mount units (regardless if
138 local or network) also acquire automatic <varname>Before=</varname> and <varname>Conflicts=</varname> on
139 <filename>umount.target</filename> in order to be stopped during shutdown.</para>
c129bd5d
LP
140
141 <para>Additional implicit dependencies may be added as result of
142 execution and resource control parameters as documented in
143 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
144 and
145 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
146 </refsect1>
147
798d3a52
ZJS
148 <refsect1>
149 <title><filename>fstab</filename></title>
150
151 <para>Mount units may either be configured via unit files, or via
152 <filename>/etc/fstab</filename> (see
3ba3a79d 153 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
798d3a52
ZJS
154 for details). Mounts listed in <filename>/etc/fstab</filename>
155 will be converted into native units dynamically at boot and when
156 the configuration of the system manager is reloaded. In general,
157 configuring mount points through <filename>/etc/fstab</filename>
158 is the preferred approach. See
159 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
160 for details about the conversion.</para>
161
773ebc0c 162 <para>The NFS mount option <option>bg</option> for NFS background mounts
0a07667d 163 as documented in <citerefentry project='man-pages'><refentrytitle>nfs</refentrytitle><manvolnum>5</manvolnum></citerefentry>
773ebc0c
TB
164 is not supported in <filename>/etc/fstab</filename> entries. The systemd mount option <option>nofail</option>
165 provides similar functionality and should be used instead.</para>
166
798d3a52
ZJS
167 <para>When reading <filename>/etc/fstab</filename> a few special
168 mount options are understood by systemd which influence how
169 dependencies are created for mount points. systemd will create a
c129bd5d 170 dependency of type <varname>Wants=</varname> or
798d3a52
ZJS
171 <option>Requires</option> (see option <option>nofail</option>
172 below), from either <filename>local-fs.target</filename> or
173 <filename>remote-fs.target</filename>, depending whether the file
174 system is local or remote.</para>
175
176 <variablelist class='fstab-options'>
177
3519d230
KZ
178 <varlistentry>
179 <term><option>x-systemd.requires=</option></term>
180
181 <listitem><para>Configures a <varname>Requires=</varname> and
182 an <varname>After=</varname> dependency between the created
183 mount unit and another systemd unit, such as a device or mount
184 unit. The argument should be a unit name, or an absolute path
185 to a device node or mount point. This option may be specified
186 more than once. This option is particularly useful for mount
187 point declarations that need an additional device to be around
188 (such as an external journal device for journal file systems)
189 or an additional mount to be in place (such as an overlay file
190 system that merges multiple mount points). See
191 <varname>After=</varname> and <varname>Requires=</varname> in
192 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
193 for details.</para></listitem>
194 </varlistentry>
195
196 <varlistentry>
197 <term><option>x-systemd.requires-mounts-for=</option></term>
198
199 <listitem><para>Configures a
200 <varname>RequiresMountsFor=</varname> dependency between the
201 created mount unit and other mount units. The argument must be
202 an absolute path. This option may be specified more than once.
203 See <varname>RequiresMountsFor=</varname> in
204 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
205 for details.</para></listitem>
206 </varlistentry>
207
798d3a52
ZJS
208 <varlistentry>
209 <term><option>x-systemd.automount</option></term>
210
211 <listitem><para>An automount unit will be created for the file
212 system. See
213 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
214 for details.</para></listitem>
215 </varlistentry>
216
deb0a77c
MO
217 <varlistentry>
218 <term><option>x-systemd.idle-timeout=</option></term>
219
a8eaaee7 220 <listitem><para>Configures the idle timeout of the
deb0a77c
MO
221 automount unit. See <varname>TimeoutIdleSec=</varname> in
222 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
223 for details.</para></listitem>
224 </varlistentry>
225
798d3a52
ZJS
226 <varlistentry>
227 <term><option>x-systemd.device-timeout=</option></term>
228
229 <listitem><para>Configure how long systemd should wait for a
230 device to show up before giving up on an entry from
231 <filename>/etc/fstab</filename>. Specify a time in seconds or
a8eaaee7 232 explicitly append a unit such as <literal>s</literal>,
798d3a52
ZJS
233 <literal>min</literal>, <literal>h</literal>,
234 <literal>ms</literal>.</para>
235
236 <para>Note that this option can only be used in
237 <filename>/etc/fstab</filename>, and will be
a8eaaee7 238 ignored when part of the <varname>Options=</varname>
798d3a52
ZJS
239 setting in a unit file.</para>
240 </listitem>
241 </varlistentry>
242
110773f6
CH
243 <varlistentry>
244 <term><option>x-systemd.mount-timeout=</option></term>
245
246 <listitem><para>Configure how long systemd should wait for the
247 mount command to finish before giving up on an entry from
248 <filename>/etc/fstab</filename>. Specify a time in seconds or
249 explicitly append a unit such as <literal>s</literal>,
250 <literal>min</literal>, <literal>h</literal>,
251 <literal>ms</literal>.</para>
252
253 <para>Note that this option can only be used in
254 <filename>/etc/fstab</filename>, and will be
255 ignored when part of the <varname>Options=</varname>
256 setting in a unit file.</para>
257
258 <para>See <varname>TimeoutSec=</varname> below for
259 details.</para>
260 </listitem>
261 </varlistentry>
798d3a52
ZJS
262 <varlistentry>
263 <term><option>noauto</option></term>
264 <term><option>auto</option></term>
265
266 <listitem><para>With <option>noauto</option>, this mount will
267 not be added as a dependency for
268 <filename>local-fs.target</filename> or
269 <filename>remote-fs.target</filename>. This means that it will
270 not be mounted automatically during boot, unless it is pulled
a8eaaee7 271 in by some other unit. The <option>auto</option> option has the
798d3a52
ZJS
272 opposite meaning and is the default.</para>
273 </listitem>
274 </varlistentry>
275
276 <varlistentry>
277 <term><option>nofail</option></term>
278
b938cb90 279 <listitem><para>With <option>nofail</option>, this mount will
798d3a52
ZJS
280 be only wanted, not required, by
281 <filename>local-fs.target</filename> or
282 <filename>remote-fs.target</filename>. This means that the
283 boot will continue even if this mount point is not mounted
284 successfully.</para>
285 </listitem>
286 </varlistentry>
287
288 <varlistentry>
289 <term><option>x-initrd.mount</option></term>
290
291 <listitem><para>An additional filesystem to be mounted in the
292 initramfs. See <filename>initrd-fs.target</filename>
293 description in
294 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
295 </para></listitem>
296 </varlistentry>
297 </variablelist>
298
299 <para>If a mount point is configured in both
300 <filename>/etc/fstab</filename> and a unit file that is stored
301 below <filename>/usr</filename>, the former will take precedence.
302 If the unit file is stored below <filename>/etc</filename>, it
303 will take precedence. This means: native unit files take
304 precedence over traditional configuration files, but this is
305 superseded by the rule that configuration in
306 <filename>/etc</filename> will always take precedence over
307 configuration in <filename>/usr</filename>.</para>
308 </refsect1>
309
310 <refsect1>
311 <title>Options</title>
312
313 <para>Mount files must include a [Mount] section, which carries
314 information about the file system mount points it supervises. A
315 number of options that may be used in this section are shared with
316 other unit types. These options are documented in
317 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
318 and
319 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
320 The options specific to the [Mount] section of mount units are the
321 following:</para>
322
323 <variablelist class='unit-directives'>
324
325 <varlistentry>
326 <term><varname>What=</varname></term>
327 <listitem><para>Takes an absolute path of a device node, file
328 or other resource to mount. See
3ba3a79d 329 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
330 for details. If this refers to a device node, a dependency on
331 the respective device unit is automatically created. (See
332 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
333 for more information.) This option is
334 mandatory.</para></listitem>
335 </varlistentry>
336
337 <varlistentry>
338 <term><varname>Where=</varname></term>
339 <listitem><para>Takes an absolute path of a directory of the
340 mount point. If the mount point does not exist at the time of
341 mounting, it is created. This string must be reflected in the
342 unit filename. (See above.) This option is
343 mandatory.</para></listitem>
344 </varlistentry>
345
346 <varlistentry>
347 <term><varname>Type=</varname></term>
348 <listitem><para>Takes a string for the file system type. See
3ba3a79d 349 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
350 for details. This setting is optional.</para></listitem>
351 </varlistentry>
352
353 <varlistentry>
354 <term><varname>Options=</varname></term>
355
356 <listitem><para>Mount options to use when mounting. This takes
357 a comma-separated list of options. This setting is
358 optional.</para></listitem>
359 </varlistentry>
360
361 <varlistentry>
362 <term><varname>SloppyOptions=</varname></term>
363
364 <listitem><para>Takes a boolean argument. If true, parsing of
365 the options specified in <varname>Options=</varname> is
366 relaxed, and unknown mount options are tolerated. This
367 corresponds with
3ba3a79d 368 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
798d3a52
ZJS
369 <parameter>-s</parameter> switch. Defaults to
370 off.</para></listitem>
371 </varlistentry>
e520950a
BR
372
373 <varlistentry>
374 <term><varname>LazyUnmount=</varname></term>
375
376 <listitem><para>Takes a boolean argument. If true, detach the
377 filesystem from the filesystem hierarchy at time of the unmount
378 operation, and clean up all references to the filesystem as
379 soon as they are not busy anymore.
380 This corresponds with
381 <citerefentry project='man-pages'><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
382 <parameter>-l</parameter> switch. Defaults to
383 off.</para></listitem>
384 </varlistentry>
4f8d40a9
BR
385
386 <varlistentry>
387 <term><varname>ForceUnmount=</varname></term>
388
389 <listitem><para>Takes a boolean argument. If true, force an
390 unmount (in case of an unreachable NFS system).
391 This corresponds with
392 <citerefentry project='man-pages'><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
393 <parameter>-f</parameter> switch. Defaults to
394 off.</para></listitem>
395 </varlistentry>
798d3a52
ZJS
396
397 <varlistentry>
398 <term><varname>DirectoryMode=</varname></term>
399 <listitem><para>Directories of mount points (and any parent
400 directories) are automatically created if needed. This option
401 specifies the file system access mode used when creating these
402 directories. Takes an access mode in octal notation. Defaults
403 to 0755.</para></listitem>
404 </varlistentry>
405
406 <varlistentry>
407 <term><varname>TimeoutSec=</varname></term>
408 <listitem><para>Configures the time to wait for the mount
409 command to finish. If a command does not exit within the
410 configured time, the mount will be considered failed and be
411 shut down again. All commands still running will be terminated
412 forcibly via <constant>SIGTERM</constant>, and after another
413 delay of this time with <constant>SIGKILL</constant>. (See
414 <option>KillMode=</option> in
415 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
416 Takes a unit-less value in seconds, or a time span value such
417 as "5min 20s". Pass 0 to disable the timeout logic. The
418 default value is set from the manager configuration file's
871583be 419 <varname>DefaultTimeoutStartSec=</varname>
798d3a52
ZJS
420 variable.</para></listitem>
421 </varlistentry>
422 </variablelist>
423
424 <para>Check
425 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
426 and
427 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
428 for more settings.</para>
429 </refsect1>
430
431 <refsect1>
432 <title>See Also</title>
433 <para>
434 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
435 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
436 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
437 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
438 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
439 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
440 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
441 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
442 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
3ba3a79d 443 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
798d3a52
ZJS
444 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
445 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
446 </para>
447 </refsect1>
cdb788e4
LP
448
449</refentry>