]>
Commit | Line | Data |
---|---|---|
cdb788e4 | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
cdb788e4 LP |
5 | |
6 | <refentry id="systemd.mount"> | |
798d3a52 ZJS |
7 | <refentryinfo> |
8 | <title>systemd.mount</title> | |
9 | <productname>systemd</productname> | |
798d3a52 ZJS |
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 | |
bdac5608 ZJS |
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> | |
798d3a52 ZJS |
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 | |
3ba3a79d | 44 | <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
3f2d1365 | 45 | program is executed in, and in |
798d3a52 ZJS |
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 | |
5e0aff56 AJ |
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, | |
3ba3a79d | 58 | <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
5e0aff56 AJ |
59 | does not read any options from <filename>/etc/fstab</filename>, and |
60 | must be run as UID 0.</para> | |
798d3a52 | 61 | |
f4bf8d2f | 62 | <para>Mount units must be named after the mount point directories they control. Example: the mount point <filename |
b0343f8c | 63 | index="false">/home/lennart</filename> must be configured in a unit file <filename>home-lennart.mount</filename>. |
f4bf8d2f LP |
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 | |
67 | it.</para> | |
798d3a52 ZJS |
68 | |
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> | |
72 | ||
798d3a52 ZJS |
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>. | |
78 | </para> | |
79 | ||
80 | <para>Some file systems have special semantics as API file systems | |
ff9b60f3 | 81 | for kernel-to-userspace and userspace-to-userspace interfaces. Some |
798d3a52 ZJS |
82 | of them may not be changed via mount units, and cannot be |
83 | disabled. For a longer discussion see <ulink | |
28a0ad81 | 84 | url="https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems">API |
798d3a52 | 85 | File Systems</ulink>.</para> |
438e6a48 LP |
86 | |
87 | <para>The | |
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> | |
798d3a52 ZJS |
91 | </refsect1> |
92 | ||
c129bd5d | 93 | <refsect1> |
aed5cb03 ZJS |
94 | <title>Automatic Dependencies</title> |
95 | ||
96 | <refsect2> | |
97 | <title>Implicit Dependencies</title> | |
98 | ||
99 | <para>The following dependencies are implicitly added:</para> | |
100 | ||
101 | <itemizedlist> | |
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> | |
105 | ||
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> | |
110 | ||
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> | |
116 | ||
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> | |
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 | |
321cd1c1 YW |
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> | |
aed5cb03 ZJS |
139 | |
140 | <listitem><para>Network mount units | |
141 | automatically acquire <varname>After=</varname> dependencies on <filename>remote-fs-pre.target</filename>, | |
321cd1c1 YW |
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 | |
aed5cb03 ZJS |
145 | <varname>Wants=</varname> unit is added as well.</para></listitem> |
146 | </itemizedlist> | |
147 | ||
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> | |
152 | </refsect2> | |
c129bd5d LP |
153 | </refsect1> |
154 | ||
798d3a52 ZJS |
155 | <refsect1> |
156 | <title><filename>fstab</filename></title> | |
157 | ||
158 | <para>Mount units may either be configured via unit files, or via | |
159 | <filename>/etc/fstab</filename> (see | |
3ba3a79d | 160 | <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
798d3a52 ZJS |
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> | |
168 | ||
773ebc0c | 169 | <para>The NFS mount option <option>bg</option> for NFS background mounts |
0a07667d | 170 | as documented in <citerefentry project='man-pages'><refentrytitle>nfs</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
65e1dee7 N |
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 | |
41fc3fab | 174 | as though <literal>x-systemd.mount-timeout=infinity,retry=10000</literal> was |
65e1dee7 N |
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> | |
773ebc0c | 180 | |
798d3a52 ZJS |
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 | |
c129bd5d | 184 | dependency of type <varname>Wants=</varname> or |
a37ef455 | 185 | <option>Requires=</option> (see option <option>nofail</option> |
798d3a52 ZJS |
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> | |
189 | ||
190 | <variablelist class='fstab-options'> | |
191 | ||
3519d230 KZ |
192 | <varlistentry> |
193 | <term><option>x-systemd.requires=</option></term> | |
194 | ||
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> | |
045c5faf FB |
207 | for details.</para> |
208 | ||
209 | <para>Note that this option always applies to the created mount unit | |
210 | only regardless whether <option>x-systemd.automount</option> has been | |
211 | specified.</para></listitem> | |
3519d230 KZ |
212 | </varlistentry> |
213 | ||
ae325185 RB |
214 | <varlistentry> |
215 | <term><option>x-systemd.before=</option></term> | |
216 | <term><option>x-systemd.after=</option></term> | |
217 | ||
81248e7f AR |
218 | <listitem><para>In the created mount unit, configures a |
219 | <varname>Before=</varname> or <varname>After=</varname> | |
220 | dependency on another systemd unit, such as a mount unit. | |
ae325185 RB |
221 | The argument should be a unit name or an absolute path |
222 | to a mount point. This option may be specified more than once. | |
223 | This option is particularly useful for mount point declarations | |
224 | with <option>nofail</option> option that are mounted | |
225 | asynchronously but need to be mounted before or after some unit | |
226 | start, for example, before <filename>local-fs.target</filename> | |
227 | unit. | |
228 | See <varname>Before=</varname> and <varname>After=</varname> in | |
229 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
045c5faf FB |
230 | for details.</para> |
231 | ||
232 | <para>Note that these options always apply to the created mount unit | |
233 | only regardless whether <option>x-systemd.automount</option> has been | |
234 | specified.</para></listitem> | |
ae325185 RB |
235 | </varlistentry> |
236 | ||
be02c1cf AR |
237 | <varlistentry> |
238 | <term><option>x-systemd.wanted-by=</option></term> | |
239 | <term><option>x-systemd.required-by=</option></term> | |
240 | ||
241 | <listitem><para>In the created mount unit, configures a | |
242 | <varname>WantedBy=</varname> or <varname>RequiredBy=</varname> | |
243 | dependency on another unit. This option may be | |
244 | specified more than once. If this is specified, the normal | |
245 | automatic dependencies on the created mount unit, e.g., | |
246 | <filename>local-fs.target</filename>, are not automatically | |
247 | created. See <varname>WantedBy=</varname> and <varname>RequiredBy=</varname> in | |
248 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
249 | for details.</para></listitem> | |
250 | </varlistentry> | |
251 | ||
3519d230 KZ |
252 | <varlistentry> |
253 | <term><option>x-systemd.requires-mounts-for=</option></term> | |
254 | ||
255 | <listitem><para>Configures a | |
256 | <varname>RequiresMountsFor=</varname> dependency between the | |
257 | created mount unit and other mount units. The argument must be | |
258 | an absolute path. This option may be specified more than once. | |
259 | See <varname>RequiresMountsFor=</varname> in | |
260 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
261 | for details.</para></listitem> | |
262 | </varlistentry> | |
263 | ||
ebc8968b FB |
264 | <varlistentry> |
265 | <term><option>x-systemd.device-bound</option></term> | |
266 | ||
267 | <listitem><para>The block device backed file system will be upgraded | |
268 | to <varname>BindsTo=</varname> dependency. This option is only useful | |
269 | when mounting file systems manually with | |
98e9d710 | 270 | <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
ebc8968b FB |
271 | as the default dependency in this case is <varname>Requires=</varname>. |
272 | This option is already implied by entries in <filename>/etc/fstab</filename> | |
273 | or by mount units. | |
274 | </para></listitem> | |
275 | </varlistentry> | |
276 | ||
798d3a52 ZJS |
277 | <varlistentry> |
278 | <term><option>x-systemd.automount</option></term> | |
279 | ||
280 | <listitem><para>An automount unit will be created for the file | |
281 | system. See | |
282 | <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
283 | for details.</para></listitem> | |
284 | </varlistentry> | |
285 | ||
deb0a77c MO |
286 | <varlistentry> |
287 | <term><option>x-systemd.idle-timeout=</option></term> | |
288 | ||
a8eaaee7 | 289 | <listitem><para>Configures the idle timeout of the |
deb0a77c MO |
290 | automount unit. See <varname>TimeoutIdleSec=</varname> in |
291 | <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
292 | for details.</para></listitem> | |
293 | </varlistentry> | |
294 | ||
f0c5cda2 | 295 | <varlistentry id='device-timeout'> |
798d3a52 ZJS |
296 | <term><option>x-systemd.device-timeout=</option></term> |
297 | ||
298 | <listitem><para>Configure how long systemd should wait for a | |
299 | device to show up before giving up on an entry from | |
300 | <filename>/etc/fstab</filename>. Specify a time in seconds or | |
a8eaaee7 | 301 | explicitly append a unit such as <literal>s</literal>, |
798d3a52 ZJS |
302 | <literal>min</literal>, <literal>h</literal>, |
303 | <literal>ms</literal>.</para> | |
304 | ||
305 | <para>Note that this option can only be used in | |
306 | <filename>/etc/fstab</filename>, and will be | |
a8eaaee7 | 307 | ignored when part of the <varname>Options=</varname> |
798d3a52 ZJS |
308 | setting in a unit file.</para> |
309 | </listitem> | |
310 | </varlistentry> | |
311 | ||
110773f6 CH |
312 | <varlistentry> |
313 | <term><option>x-systemd.mount-timeout=</option></term> | |
314 | ||
315 | <listitem><para>Configure how long systemd should wait for the | |
316 | mount command to finish 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 | <para>See <varname>TimeoutSec=</varname> below for | |
328 | details.</para> | |
329 | </listitem> | |
330 | </varlistentry> | |
0f00528d | 331 | |
58e0ac33 ZJS |
332 | <varlistentry> |
333 | <term><option>x-systemd.makefs</option></term> | |
334 | ||
f0c5cda2 | 335 | <listitem><para>The file system will be initialized |
58e0ac33 ZJS |
336 | on the device. If the device is not "empty", i.e. it contains any signature, |
337 | the operation will be skipped. It is hence expected that this option | |
5238e957 | 338 | remains set even after the device has been initialized.</para> |
58e0ac33 ZJS |
339 | |
340 | <para>Note that this option can only be used in | |
341 | <filename>/etc/fstab</filename>, and will be ignored when part of the | |
342 | <varname>Options=</varname> setting in a unit file.</para> | |
343 | ||
344 | <para>See | |
345 | <citerefentry><refentrytitle>systemd-makefs@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. | |
346 | </para> | |
347 | ||
348 | <para><citerefentry project='man-pages'><refentrytitle>wipefs</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
349 | may be used to remove any signatures from a block device to force | |
350 | <option>x-systemd.makefs</option> to reinitialize the device.</para> | |
351 | </listitem> | |
352 | </varlistentry> | |
353 | ||
354 | <varlistentry> | |
355 | <term><option>x-systemd.growfs</option></term> | |
356 | ||
357 | <listitem><para>The file system will be grown to occupy the full block | |
358 | device. If the file system is already at maximum size, no action will | |
359 | be performed. It is hence expected that this option remains set even after | |
360 | the file system has been grown. Only certain file system types are supported, | |
361 | see | |
362 | <citerefentry><refentrytitle>systemd-makefs@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
363 | for details.</para> | |
364 | ||
365 | <para>Note that this option can only be used in | |
366 | <filename>/etc/fstab</filename>, and will be ignored when part of the | |
367 | <varname>Options=</varname> setting in a unit file.</para></listitem> | |
368 | </varlistentry> | |
369 | ||
ad765605 MH |
370 | <varlistentry> |
371 | <term><option>x-systemd.rw-only</option></term> | |
372 | ||
373 | <listitem><para>If a mount operation fails to mount the file system | |
374 | read-write, it normally tries mounting the file system read-only instead. | |
375 | This option disables that behaviour, and causes the mount to fail | |
376 | immediately instead. This option is translated into the | |
377 | <varname>ReadWriteOnly=</varname> setting in a unit file.</para> | |
378 | </listitem> | |
379 | </varlistentry> | |
380 | ||
0f00528d ZJS |
381 | <varlistentry> |
382 | <term><option>_netdev</option></term> | |
383 | ||
384 | <listitem><para>Normally the file system type is used to determine if a | |
385 | mount is a "network mount", i.e. if it should only be started after the | |
386 | network is available. Using this option overrides this detection and | |
387 | specifies that the mount requires network.</para> | |
388 | ||
389 | <para>Network mount units are ordered between <filename>remote-fs-pre.target</filename> | |
390 | and <filename>remote-fs.target</filename>, instead of | |
391 | <filename>local-fs-pre.target</filename> and <filename>local-fs.target</filename>. | |
392 | They also pull in <filename>network-online.target</filename> and are ordered after | |
393 | it and <filename>network.target</filename>.</para> | |
394 | </listitem> | |
395 | </varlistentry> | |
396 | ||
798d3a52 ZJS |
397 | <varlistentry> |
398 | <term><option>noauto</option></term> | |
399 | <term><option>auto</option></term> | |
400 | ||
0c08bc7f LP |
401 | <listitem><para>With <option>noauto</option>, the mount unit will not be added as a dependency for |
402 | <filename>local-fs.target</filename> or <filename>remote-fs.target</filename>. This means that it will not be | |
403 | mounted automatically during boot, unless it is pulled in by some other unit. The <option>auto</option> option | |
404 | has the opposite meaning and is the default. Note that the <option>noauto</option> option has an effect on the | |
405 | mount unit itself only — if <option>x-systemd.automount</option> is used (see above), then the matching | |
406 | automount unit will still be pulled in by these targets.</para> | |
798d3a52 ZJS |
407 | </listitem> |
408 | </varlistentry> | |
409 | ||
410 | <varlistentry> | |
411 | <term><option>nofail</option></term> | |
412 | ||
e6c7c7ff LP |
413 | <listitem><para>With <option>nofail</option>, this mount will be only wanted, not required, by |
414 | <filename>local-fs.target</filename> or <filename>remote-fs.target</filename>. Moreover the mount unit is not | |
415 | ordered before these target units. This means that the boot will continue without waiting for the mount unit | |
416 | and regardless whether the mount point can be mounted successfully.</para> | |
798d3a52 ZJS |
417 | </listitem> |
418 | </varlistentry> | |
419 | ||
420 | <varlistentry> | |
421 | <term><option>x-initrd.mount</option></term> | |
422 | ||
423 | <listitem><para>An additional filesystem to be mounted in the | |
424 | initramfs. See <filename>initrd-fs.target</filename> | |
425 | description in | |
426 | <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>. | |
427 | </para></listitem> | |
428 | </varlistentry> | |
429 | </variablelist> | |
430 | ||
431 | <para>If a mount point is configured in both | |
432 | <filename>/etc/fstab</filename> and a unit file that is stored | |
433 | below <filename>/usr</filename>, the former will take precedence. | |
434 | If the unit file is stored below <filename>/etc</filename>, it | |
435 | will take precedence. This means: native unit files take | |
436 | precedence over traditional configuration files, but this is | |
437 | superseded by the rule that configuration in | |
438 | <filename>/etc</filename> will always take precedence over | |
439 | configuration in <filename>/usr</filename>.</para> | |
440 | </refsect1> | |
441 | ||
442 | <refsect1> | |
443 | <title>Options</title> | |
444 | ||
445 | <para>Mount files must include a [Mount] section, which carries | |
446 | information about the file system mount points it supervises. A | |
447 | number of options that may be used in this section are shared with | |
448 | other unit types. These options are documented in | |
449 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
450 | and | |
451 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>. | |
452 | The options specific to the [Mount] section of mount units are the | |
453 | following:</para> | |
454 | ||
455 | <variablelist class='unit-directives'> | |
456 | ||
457 | <varlistentry> | |
458 | <term><varname>What=</varname></term> | |
151a7133 LP |
459 | <listitem><para>Takes an absolute path of a device node, file or other resource to mount. See |
460 | <citerefentry | |
461 | project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> for | |
462 | details. If this refers to a device node, a dependency on the respective device unit is automatically | |
463 | created. (See | |
464 | <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
465 | for more information.) This option is mandatory. Note that the usual specifier expansion is applied | |
6dbf4025 ZJS |
466 | to this setting, literal percent characters should hence be written as <literal |
467 | class='specifiers'>%%</literal>. If this mount is a bind mount and the specified path does not exist | |
468 | yet it is created as directory.</para></listitem> | |
798d3a52 ZJS |
469 | </varlistentry> |
470 | ||
471 | <varlistentry> | |
472 | <term><varname>Where=</varname></term> | |
f9951b0c LP |
473 | <listitem><para>Takes an absolute path of a file or directory for the mount point; in particular, the |
474 | destination cannot be a symbolic link. If the mount point does not exist at the time of mounting, it | |
475 | is created as directory. This string must be reflected in the unit filename. (See above.) This option | |
476 | is mandatory.</para></listitem> | |
798d3a52 ZJS |
477 | </varlistentry> |
478 | ||
479 | <varlistentry> | |
480 | <term><varname>Type=</varname></term> | |
481 | <listitem><para>Takes a string for the file system type. See | |
3ba3a79d | 482 | <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
798d3a52 ZJS |
483 | for details. This setting is optional.</para></listitem> |
484 | </varlistentry> | |
485 | ||
486 | <varlistentry> | |
487 | <term><varname>Options=</varname></term> | |
488 | ||
d5cc4be2 LP |
489 | <listitem><para>Mount options to use when mounting. This takes a comma-separated list of options. This setting |
490 | is optional. Note that the usual specifier expansion is applied to this setting, literal percent characters | |
6dbf4025 | 491 | should hence be written as <literal class='specifiers'>%%</literal>.</para></listitem> |
798d3a52 ZJS |
492 | </varlistentry> |
493 | ||
494 | <varlistentry> | |
495 | <term><varname>SloppyOptions=</varname></term> | |
496 | ||
497 | <listitem><para>Takes a boolean argument. If true, parsing of | |
498 | the options specified in <varname>Options=</varname> is | |
499 | relaxed, and unknown mount options are tolerated. This | |
500 | corresponds with | |
3ba3a79d | 501 | <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s |
798d3a52 ZJS |
502 | <parameter>-s</parameter> switch. Defaults to |
503 | off.</para></listitem> | |
504 | </varlistentry> | |
e520950a BR |
505 | |
506 | <varlistentry> | |
507 | <term><varname>LazyUnmount=</varname></term> | |
508 | ||
509 | <listitem><para>Takes a boolean argument. If true, detach the | |
510 | filesystem from the filesystem hierarchy at time of the unmount | |
511 | operation, and clean up all references to the filesystem as | |
512 | soon as they are not busy anymore. | |
513 | This corresponds with | |
514 | <citerefentry project='man-pages'><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s | |
515 | <parameter>-l</parameter> switch. Defaults to | |
516 | off.</para></listitem> | |
517 | </varlistentry> | |
4f8d40a9 | 518 | |
75f4bd7f MH |
519 | <varlistentry> |
520 | <term><varname>ReadWriteOnly=</varname></term> | |
521 | ||
522 | <listitem><para>Takes a boolean argument. If false, a mount | |
523 | point that shall be mounted read-write but cannot be mounted | |
524 | so is retried to be mounted read-only. If true the operation | |
525 | will fail immediately after the read-write mount attempt did | |
526 | not succeed. This corresponds with | |
527 | <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s | |
528 | <parameter>-w</parameter> switch. Defaults to | |
529 | off.</para></listitem> | |
530 | </varlistentry> | |
531 | ||
4f8d40a9 BR |
532 | <varlistentry> |
533 | <term><varname>ForceUnmount=</varname></term> | |
534 | ||
535 | <listitem><para>Takes a boolean argument. If true, force an | |
536 | unmount (in case of an unreachable NFS system). | |
537 | This corresponds with | |
538 | <citerefentry project='man-pages'><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s | |
539 | <parameter>-f</parameter> switch. Defaults to | |
540 | off.</para></listitem> | |
541 | </varlistentry> | |
798d3a52 ZJS |
542 | |
543 | <varlistentry> | |
544 | <term><varname>DirectoryMode=</varname></term> | |
545 | <listitem><para>Directories of mount points (and any parent | |
546 | directories) are automatically created if needed. This option | |
547 | specifies the file system access mode used when creating these | |
548 | directories. Takes an access mode in octal notation. Defaults | |
549 | to 0755.</para></listitem> | |
550 | </varlistentry> | |
551 | ||
552 | <varlistentry> | |
553 | <term><varname>TimeoutSec=</varname></term> | |
554 | <listitem><para>Configures the time to wait for the mount | |
555 | command to finish. If a command does not exit within the | |
556 | configured time, the mount will be considered failed and be | |
557 | shut down again. All commands still running will be terminated | |
558 | forcibly via <constant>SIGTERM</constant>, and after another | |
559 | delay of this time with <constant>SIGKILL</constant>. (See | |
560 | <option>KillMode=</option> in | |
561 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.) | |
562 | Takes a unit-less value in seconds, or a time span value such | |
563 | as "5min 20s". Pass 0 to disable the timeout logic. The | |
7e68a33b YW |
564 | default value is set from <varname>DefaultTimeoutStartSec=</varname> option in |
565 | <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. | |
566 | </para></listitem> | |
798d3a52 ZJS |
567 | </varlistentry> |
568 | </variablelist> | |
569 | ||
570 | <para>Check | |
571 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
572 | and | |
573 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
574 | for more settings.</para> | |
575 | </refsect1> | |
576 | ||
577 | <refsect1> | |
578 | <title>See Also</title> | |
579 | <para> | |
580 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
581 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
7e68a33b | 582 | <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
798d3a52 ZJS |
583 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
584 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
585 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
586 | <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
587 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
588 | <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
589 | <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
3ba3a79d | 590 | <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
798d3a52 | 591 | <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
438e6a48 LP |
592 | <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>, |
593 | <citerefentry><refentrytitle>systemd-mount</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
798d3a52 ZJS |
594 | </para> |
595 | </refsect1> | |
cdb788e4 LP |
596 | |
597 | </refentry> |