]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.mount.xml
journal-remote: remove unnecessary gnutls includes (#3895)
[thirdparty/systemd.git] / man / systemd.mount.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
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
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
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
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="systemd.mount">
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
71 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
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>;
81 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
82 will refuse options that are not listed in
83 <filename>/etc/fstab</filename> if it is not run as UID 0.</para>
84
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>
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
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
104 for kernel-to-userspace and userspace-to-userspace interfaces. Some
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
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
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>
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
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
153 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
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
162 <para>The NFS mount option <option>bg</option> for NFS background mounts
163 as documented in <citerefentry><refentrytitle>nfs</refentrytitle><manvolnum>5</manvolnum></citerefentry>
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
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
170 dependency of type <varname>Wants=</varname> or
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
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
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
217 <varlistentry>
218 <term><option>x-systemd.idle-timeout=</option></term>
219
220 <listitem><para>Configures the idle timeout of the
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
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
232 explicitly append a unit such as <literal>s</literal>,
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
238 ignored when part of the <varname>Options=</varname>
239 setting in a unit file.</para>
240 </listitem>
241 </varlistentry>
242
243 <varlistentry>
244 <term><option>noauto</option></term>
245 <term><option>auto</option></term>
246
247 <listitem><para>With <option>noauto</option>, this mount will
248 not be added as a dependency for
249 <filename>local-fs.target</filename> or
250 <filename>remote-fs.target</filename>. This means that it will
251 not be mounted automatically during boot, unless it is pulled
252 in by some other unit. The <option>auto</option> option has the
253 opposite meaning and is the default.</para>
254 </listitem>
255 </varlistentry>
256
257 <varlistentry>
258 <term><option>nofail</option></term>
259
260 <listitem><para>With <option>nofail</option>, this mount will
261 be only wanted, not required, by
262 <filename>local-fs.target</filename> or
263 <filename>remote-fs.target</filename>. This means that the
264 boot will continue even if this mount point is not mounted
265 successfully.</para>
266 </listitem>
267 </varlistentry>
268
269 <varlistentry>
270 <term><option>x-initrd.mount</option></term>
271
272 <listitem><para>An additional filesystem to be mounted in the
273 initramfs. See <filename>initrd-fs.target</filename>
274 description in
275 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
276 </para></listitem>
277 </varlistentry>
278 </variablelist>
279
280 <para>If a mount point is configured in both
281 <filename>/etc/fstab</filename> and a unit file that is stored
282 below <filename>/usr</filename>, the former will take precedence.
283 If the unit file is stored below <filename>/etc</filename>, it
284 will take precedence. This means: native unit files take
285 precedence over traditional configuration files, but this is
286 superseded by the rule that configuration in
287 <filename>/etc</filename> will always take precedence over
288 configuration in <filename>/usr</filename>.</para>
289 </refsect1>
290
291 <refsect1>
292 <title>Options</title>
293
294 <para>Mount files must include a [Mount] section, which carries
295 information about the file system mount points it supervises. A
296 number of options that may be used in this section are shared with
297 other unit types. These options are documented in
298 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
299 and
300 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
301 The options specific to the [Mount] section of mount units are the
302 following:</para>
303
304 <variablelist class='unit-directives'>
305
306 <varlistentry>
307 <term><varname>What=</varname></term>
308 <listitem><para>Takes an absolute path of a device node, file
309 or other resource to mount. See
310 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
311 for details. If this refers to a device node, a dependency on
312 the respective device unit is automatically created. (See
313 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
314 for more information.) This option is
315 mandatory.</para></listitem>
316 </varlistentry>
317
318 <varlistentry>
319 <term><varname>Where=</varname></term>
320 <listitem><para>Takes an absolute path of a directory of the
321 mount point. If the mount point does not exist at the time of
322 mounting, it is created. This string must be reflected in the
323 unit filename. (See above.) This option is
324 mandatory.</para></listitem>
325 </varlistentry>
326
327 <varlistentry>
328 <term><varname>Type=</varname></term>
329 <listitem><para>Takes a string for the file system type. See
330 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
331 for details. This setting is optional.</para></listitem>
332 </varlistentry>
333
334 <varlistentry>
335 <term><varname>Options=</varname></term>
336
337 <listitem><para>Mount options to use when mounting. This takes
338 a comma-separated list of options. This setting is
339 optional.</para></listitem>
340 </varlistentry>
341
342 <varlistentry>
343 <term><varname>SloppyOptions=</varname></term>
344
345 <listitem><para>Takes a boolean argument. If true, parsing of
346 the options specified in <varname>Options=</varname> is
347 relaxed, and unknown mount options are tolerated. This
348 corresponds with
349 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
350 <parameter>-s</parameter> switch. Defaults to
351 off.</para></listitem>
352 </varlistentry>
353
354 <varlistentry>
355 <term><varname>DirectoryMode=</varname></term>
356 <listitem><para>Directories of mount points (and any parent
357 directories) are automatically created if needed. This option
358 specifies the file system access mode used when creating these
359 directories. Takes an access mode in octal notation. Defaults
360 to 0755.</para></listitem>
361 </varlistentry>
362
363 <varlistentry>
364 <term><varname>TimeoutSec=</varname></term>
365 <listitem><para>Configures the time to wait for the mount
366 command to finish. If a command does not exit within the
367 configured time, the mount will be considered failed and be
368 shut down again. All commands still running will be terminated
369 forcibly via <constant>SIGTERM</constant>, and after another
370 delay of this time with <constant>SIGKILL</constant>. (See
371 <option>KillMode=</option> in
372 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
373 Takes a unit-less value in seconds, or a time span value such
374 as "5min 20s". Pass 0 to disable the timeout logic. The
375 default value is set from the manager configuration file's
376 <varname>DefaultTimeoutStart=</varname>
377 variable.</para></listitem>
378 </varlistentry>
379 </variablelist>
380
381 <para>Check
382 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
383 and
384 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
385 for more settings.</para>
386 </refsect1>
387
388 <refsect1>
389 <title>See Also</title>
390 <para>
391 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
392 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
393 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
394 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
395 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
396 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
397 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
398 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
399 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
400 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
401 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
402 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
403 </para>
404 </refsect1>
405
406 </refentry>