]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.mount.xml
test-execute: Add tests for new PassEnvironment= directive
[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
86 they control. Example: the mount point
87 <filename noindex='true'>/home/lennart</filename> must be
88 configured in a unit file <filename>home-lennart.mount</filename>.
89 For details about the escaping logic used to convert a file system
90 path to a unit name, see
91 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
92
93 <para>Optionally, a mount unit may be accompanied by an automount
94 unit, to allow on-demand or parallelized mounting. See
95 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
96
97 <para>If a mount point is beneath another mount point in the file
98 system hierarchy, a dependency between both units is created
99 automatically.</para>
100
101 <para>Mount points created at runtime (independently of unit files
102 or <filename>/etc/fstab</filename>) will be monitored by systemd
103 and appear like any other mount unit in systemd. See
104 <filename>/proc/self/mountinfo</filename> description in
105 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
106 </para>
107
108 <para>Some file systems have special semantics as API file systems
109 for kernel-to-userspace and userspace-to-userspace interfaces. Some
110 of them may not be changed via mount units, and cannot be
111 disabled. For a longer discussion see <ulink
112 url="http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems">API
113 File Systems</ulink>.</para>
114 </refsect1>
115
116 <refsect1>
117 <title><filename>fstab</filename></title>
118
119 <para>Mount units may either be configured via unit files, or via
120 <filename>/etc/fstab</filename> (see
121 <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
122 for details). Mounts listed in <filename>/etc/fstab</filename>
123 will be converted into native units dynamically at boot and when
124 the configuration of the system manager is reloaded. In general,
125 configuring mount points through <filename>/etc/fstab</filename>
126 is the preferred approach. See
127 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
128 for details about the conversion.</para>
129
130 <para>When reading <filename>/etc/fstab</filename> a few special
131 mount options are understood by systemd which influence how
132 dependencies are created for mount points. systemd will create a
133 dependency of type <option>Wants</option> or
134 <option>Requires</option> (see option <option>nofail</option>
135 below), from either <filename>local-fs.target</filename> or
136 <filename>remote-fs.target</filename>, depending whether the file
137 system is local or remote.</para>
138
139 <variablelist class='fstab-options'>
140
141 <varlistentry>
142 <term><option>x-systemd.requires=</option></term>
143
144 <listitem><para>Configures a <varname>Requires=</varname> and
145 an <varname>After=</varname> dependency between the created
146 mount unit and another systemd unit, such as a device or mount
147 unit. The argument should be a unit name, or an absolute path
148 to a device node or mount point. This option may be specified
149 more than once. This option is particularly useful for mount
150 point declarations that need an additional device to be around
151 (such as an external journal device for journal file systems)
152 or an additional mount to be in place (such as an overlay file
153 system that merges multiple mount points). See
154 <varname>After=</varname> and <varname>Requires=</varname> in
155 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
156 for details.</para></listitem>
157 </varlistentry>
158
159 <varlistentry>
160 <term><option>x-systemd.requires-mounts-for=</option></term>
161
162 <listitem><para>Configures a
163 <varname>RequiresMountsFor=</varname> dependency between the
164 created mount unit and other mount units. The argument must be
165 an absolute path. This option may be specified more than once.
166 See <varname>RequiresMountsFor=</varname> in
167 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
168 for details.</para></listitem>
169 </varlistentry>
170
171 <varlistentry>
172 <term><option>x-systemd.automount</option></term>
173
174 <listitem><para>An automount unit will be created for the file
175 system. See
176 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
177 for details.</para></listitem>
178 </varlistentry>
179
180 <varlistentry>
181 <term><option>x-systemd.idle-timeout=</option></term>
182
183 <listitem><para>Configures the idle timeout of the
184 automount unit. See <varname>TimeoutIdleSec=</varname> in
185 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
186 for details.</para></listitem>
187 </varlistentry>
188
189 <varlistentry>
190 <term><option>x-systemd.device-timeout=</option></term>
191
192 <listitem><para>Configure how long systemd should wait for a
193 device to show up before giving up on an entry from
194 <filename>/etc/fstab</filename>. Specify a time in seconds or
195 explicitly append a unit such as <literal>s</literal>,
196 <literal>min</literal>, <literal>h</literal>,
197 <literal>ms</literal>.</para>
198
199 <para>Note that this option can only be used in
200 <filename>/etc/fstab</filename>, and will be
201 ignored when part of the <varname>Options=</varname>
202 setting in a unit file.</para>
203 </listitem>
204 </varlistentry>
205
206 <varlistentry>
207 <term><option>noauto</option></term>
208 <term><option>auto</option></term>
209
210 <listitem><para>With <option>noauto</option>, this mount will
211 not be added as a dependency for
212 <filename>local-fs.target</filename> or
213 <filename>remote-fs.target</filename>. This means that it will
214 not be mounted automatically during boot, unless it is pulled
215 in by some other unit. The <option>auto</option> option has the
216 opposite meaning and is the default.</para>
217 </listitem>
218 </varlistentry>
219
220 <varlistentry>
221 <term><option>nofail</option></term>
222
223 <listitem><para>With <option>nofail</option>, this mount will
224 be only wanted, not required, by
225 <filename>local-fs.target</filename> or
226 <filename>remote-fs.target</filename>. This means that the
227 boot will continue even if this mount point is not mounted
228 successfully.</para>
229 </listitem>
230 </varlistentry>
231
232 <varlistentry>
233 <term><option>x-initrd.mount</option></term>
234
235 <listitem><para>An additional filesystem to be mounted in the
236 initramfs. See <filename>initrd-fs.target</filename>
237 description in
238 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
239 </para></listitem>
240 </varlistentry>
241 </variablelist>
242
243 <para>If a mount point is configured in both
244 <filename>/etc/fstab</filename> and a unit file that is stored
245 below <filename>/usr</filename>, the former will take precedence.
246 If the unit file is stored below <filename>/etc</filename>, it
247 will take precedence. This means: native unit files take
248 precedence over traditional configuration files, but this is
249 superseded by the rule that configuration in
250 <filename>/etc</filename> will always take precedence over
251 configuration in <filename>/usr</filename>.</para>
252 </refsect1>
253
254 <refsect1>
255 <title>Options</title>
256
257 <para>Mount files must include a [Mount] section, which carries
258 information about the file system mount points it supervises. A
259 number of options that may be used in this section are shared with
260 other unit types. These options are documented in
261 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
262 and
263 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
264 The options specific to the [Mount] section of mount units are the
265 following:</para>
266
267 <variablelist class='unit-directives'>
268
269 <varlistentry>
270 <term><varname>What=</varname></term>
271 <listitem><para>Takes an absolute path of a device node, file
272 or other resource to mount. See
273 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
274 for details. If this refers to a device node, a dependency on
275 the respective device unit is automatically created. (See
276 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
277 for more information.) This option is
278 mandatory.</para></listitem>
279 </varlistentry>
280
281 <varlistentry>
282 <term><varname>Where=</varname></term>
283 <listitem><para>Takes an absolute path of a directory of the
284 mount point. If the mount point does not exist at the time of
285 mounting, it is created. This string must be reflected in the
286 unit filename. (See above.) This option is
287 mandatory.</para></listitem>
288 </varlistentry>
289
290 <varlistentry>
291 <term><varname>Type=</varname></term>
292 <listitem><para>Takes a string for the file system type. See
293 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
294 for details. This setting is optional.</para></listitem>
295 </varlistentry>
296
297 <varlistentry>
298 <term><varname>Options=</varname></term>
299
300 <listitem><para>Mount options to use when mounting. This takes
301 a comma-separated list of options. This setting is
302 optional.</para></listitem>
303 </varlistentry>
304
305 <varlistentry>
306 <term><varname>SloppyOptions=</varname></term>
307
308 <listitem><para>Takes a boolean argument. If true, parsing of
309 the options specified in <varname>Options=</varname> is
310 relaxed, and unknown mount options are tolerated. This
311 corresponds with
312 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
313 <parameter>-s</parameter> switch. Defaults to
314 off.</para></listitem>
315 </varlistentry>
316
317 <varlistentry>
318 <term><varname>DirectoryMode=</varname></term>
319 <listitem><para>Directories of mount points (and any parent
320 directories) are automatically created if needed. This option
321 specifies the file system access mode used when creating these
322 directories. Takes an access mode in octal notation. Defaults
323 to 0755.</para></listitem>
324 </varlistentry>
325
326 <varlistentry>
327 <term><varname>SmackFileSystemRootLabel=</varname></term>
328 <listitem><para>Takes a string for the SMACK label.
329 This option specifies the label to assign the root of the
330 file system if it lacks the SMACK extended attribute.
331 Note that this option will be ignored if kernel does not
332 support the SMACK feature.
333 See <ulink
334 url="https://www.kernel.org/doc/Documentation/security/Smack.txt">Smack.txt</ulink>
335 for details. </para></listitem>
336 </varlistentry>
337
338 <varlistentry>
339 <term><varname>TimeoutSec=</varname></term>
340 <listitem><para>Configures the time to wait for the mount
341 command to finish. If a command does not exit within the
342 configured time, the mount will be considered failed and be
343 shut down again. All commands still running will be terminated
344 forcibly via <constant>SIGTERM</constant>, and after another
345 delay of this time with <constant>SIGKILL</constant>. (See
346 <option>KillMode=</option> in
347 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
348 Takes a unit-less value in seconds, or a time span value such
349 as "5min 20s". Pass 0 to disable the timeout logic. The
350 default value is set from the manager configuration file's
351 <varname>DefaultTimeoutStart=</varname>
352 variable.</para></listitem>
353 </varlistentry>
354 </variablelist>
355
356 <para>Check
357 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
358 and
359 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
360 for more settings.</para>
361 </refsect1>
362
363 <refsect1>
364 <title>See Also</title>
365 <para>
366 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
367 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
368 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
369 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
370 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
371 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
372 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
373 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
374 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
375 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
376 <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
377 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
378 </para>
379 </refsect1>
380
381 </refentry>