1SYSTEMD.MOUNT(5)                 systemd.mount                SYSTEMD.MOUNT(5)
2
3
4

NAME

6       systemd.mount - Mount unit configuration
7

SYNOPSIS

9       mount.mount
10

DESCRIPTION

12       A unit configuration file whose name ends in ".mount" encodes
13       information about a file system mount point controlled and supervised
14       by systemd.
15
16       This man page lists the configuration options specific to this unit
17       type. See systemd.unit(5) for the common options of all unit
18       configuration files. The common configuration items are configured in
19       the generic [Unit] and [Install] sections. The mount specific
20       configuration options are configured in the [Mount] section.
21
22       Additional options are listed in systemd.exec(5), which define the
23       execution environment the mount(8) program is executed in, and in
24       systemd.kill(5), which define the way the processes are terminated, and
25       in systemd.resource-control(5), which configure resource control
26       settings for the processes of the service.
27
28       Note that the options User= and Group= are not useful for mount units.
29       systemd passes two parameters to mount(8); the values of What= and
30       Where=. When invoked in this way, mount(8) does not read any options
31       from /etc/fstab, and must be run as UID 0.
32
33       Mount units must be named after the mount point directories they
34       control. Example: the mount point /home/lennart must be configured in a
35       unit file home-lennart.mount. For details about the escaping logic used
36       to convert a file system path to a unit name, see systemd.unit(5). Note
37       that mount units cannot be templated, nor is possible to add multiple
38       names to a mount unit by creating symlinks to its unit file.
39
40       Optionally, a mount unit may be accompanied by an automount unit, to
41       allow on-demand or parallelized mounting. See systemd.automount(5).
42
43       Mount points created at runtime (independently of unit files or
44       /etc/fstab) will be monitored by systemd and appear like any other
45       mount unit in systemd. See /proc/self/mountinfo description in proc(5).
46
47       Some file systems have special semantics as API file systems for
48       kernel-to-userspace and userspace-to-userspace interfaces. Some of them
49       may not be changed via mount units, and cannot be disabled. For a
50       longer discussion see API File Systems[1].
51
52       The systemd-mount(1) command allows creating .mount and .automount
53       units dynamically and transiently from the command line.
54

AUTOMATIC DEPENDENCIES

56   Implicit Dependencies
57       The following dependencies are implicitly added:
58
59       •   If a mount unit is beneath another mount unit in the file system
60           hierarchy, both a requirement dependency and an ordering dependency
61           between both units are created automatically.
62
63       •   Block device backed file systems automatically gain BindsTo= and
64           After= type dependencies on the device unit encapsulating the block
65           device (see below).
66
67       •   If traditional file system quota is enabled for a mount unit,
68           automatic Wants= and Before= dependencies on
69           systemd-quotacheck.service and quotaon.service are added.
70
71       •   Additional implicit dependencies may be added as result of
72           execution and resource control parameters as documented in
73           systemd.exec(5) and systemd.resource-control(5).
74
75   Default Dependencies
76       The following dependencies are added unless DefaultDependencies=no is
77       set:
78
79       •   All mount units acquire automatic Before= and Conflicts= on
80           umount.target in order to be stopped during shutdown.
81
82       •   Mount units referring to local file systems automatically gain an
83           After= dependency on local-fs-pre.target, and a Before= dependency
84           on local-fs.target unless nofail mount option is set.
85
86       •   Network mount units automatically acquire After= dependencies on
87           remote-fs-pre.target, network.target and network-online.target, and
88           gain a Before= dependency on remote-fs.target unless nofail mount
89           option is set. Towards the latter a Wants= unit is added as well.
90
91       Mount units referring to local and network file systems are
92       distinguished by their file system type specification. In some cases
93       this is not sufficient (for example network block device based mounts,
94       such as iSCSI), in which case _netdev may be added to the mount option
95       string of the unit, which forces systemd to consider the mount unit a
96       network mount.
97

FSTAB

99       Mount units may either be configured via unit files, or via /etc/fstab
100       (see fstab(5) for details). Mounts listed in /etc/fstab will be
101       converted into native units dynamically at boot and when the
102       configuration of the system manager is reloaded. In general,
103       configuring mount points through /etc/fstab is the preferred approach
104       to manage mounts for humans. For tooling, writing mount units should be
105       preferred over editing /etc/fstab. See systemd-fstab-generator(8) for
106       details about the conversion from /etc/fstab to mount units.
107
108       The NFS mount option bg for NFS background mounts as documented in
109       nfs(5) is detected by systemd-fstab-generator and the options are
110       transformed so that systemd fulfills the job-control implications of
111       that option. Specifically systemd-fstab-generator acts as though
112       "x-systemd.mount-timeout=infinity,retry=10000" was prepended to the
113       option list, and "fg,nofail" was appended. Depending on specific
114       requirements, it may be appropriate to provide some of these options
115       explicitly, or to make use of the "x-systemd.automount" option
116       described below instead of using "bg".
117
118       When reading /etc/fstab a few special mount options are understood by
119       systemd which influence how dependencies are created for mount points.
120       systemd will create a dependency of type Wants= or Requires= (see
121       option nofail below), from either local-fs.target or remote-fs.target,
122       depending whether the file system is local or remote.
123
124       x-systemd.requires=
125           Configures a Requires= and an After= dependency between the created
126           mount unit and another systemd unit, such as a device or mount
127           unit. The argument should be a unit name, or an absolute path to a
128           device node or mount point. This option may be specified more than
129           once. This option is particularly useful for mount point
130           declarations that need an additional device to be around (such as
131           an external journal device for journal file systems) or an
132           additional mount to be in place (such as an overlay file system
133           that merges multiple mount points). See After= and Requires= in
134           systemd.unit(5) for details.
135
136           Note that this option always applies to the created mount unit only
137           regardless whether x-systemd.automount has been specified.
138
139       x-systemd.before=, x-systemd.after=
140           In the created mount unit, configures a Before= or After=
141           dependency on another systemd unit, such as a mount unit. The
142           argument should be a unit name or an absolute path to a mount
143           point. This option may be specified more than once. This option is
144           particularly useful for mount point declarations with nofail option
145           that are mounted asynchronously but need to be mounted before or
146           after some unit start, for example, before local-fs.target unit.
147           See Before= and After= in systemd.unit(5) for details.
148
149           Note that these options always apply to the created mount unit only
150           regardless whether x-systemd.automount has been specified.
151
152       x-systemd.wanted-by=, x-systemd.required-by=
153           In the created mount unit, configures a WantedBy= or RequiredBy=
154           dependency on another unit. This option may be specified more than
155           once. If this is specified, the normal automatic dependencies on
156           the created mount unit, e.g., local-fs.target, are not
157           automatically created. See WantedBy= and RequiredBy= in
158           systemd.unit(5) for details.
159
160       x-systemd.requires-mounts-for=
161           Configures a RequiresMountsFor= dependency between the created
162           mount unit and other mount units. The argument must be an absolute
163           path. This option may be specified more than once. See
164           RequiresMountsFor= in systemd.unit(5) for details.
165
166       x-systemd.device-bound
167           The block device backed file system will be upgraded to BindsTo=
168           dependency. This option is only useful when mounting file systems
169           manually with mount(8) as the default dependency in this case is
170           Requires=. This option is already implied by entries in /etc/fstab
171           or by mount units.
172
173       x-systemd.automount
174           An automount unit will be created for the file system. See
175           systemd.automount(5) for details.
176
177       x-systemd.idle-timeout=
178           Configures the idle timeout of the automount unit. See
179           TimeoutIdleSec= in systemd.automount(5) for details.
180
181       x-systemd.device-timeout=
182           Configure how long systemd should wait for a device to show up
183           before giving up on an entry from /etc/fstab. Specify a time in
184           seconds or explicitly append a unit such as "s", "min", "h", "ms".
185
186           Note that this option can only be used in /etc/fstab, and will be
187           ignored when part of the Options= setting in a unit file.
188
189       x-systemd.mount-timeout=
190           Configure how long systemd should wait for the mount command to
191           finish before giving up on an entry from /etc/fstab. Specify a time
192           in seconds or explicitly append a unit such as "s", "min", "h",
193           "ms".
194
195           Note that this option can only be used in /etc/fstab, and will be
196           ignored when part of the Options= setting in a unit file.
197
198           See TimeoutSec= below for details.
199
200       x-systemd.makefs
201           The file system will be initialized on the device. If the device is
202           not "empty", i.e. it contains any signature, the operation will be
203           skipped. It is hence expected that this option remains set even
204           after the device has been initialized.
205
206           Note that this option can only be used in /etc/fstab, and will be
207           ignored when part of the Options= setting in a unit file.
208
209           See systemd-makefs@.service(8).
210
211           wipefs(8) may be used to remove any signatures from a block device
212           to force x-systemd.makefs to reinitialize the device.
213
214       x-systemd.growfs
215           The file system will be grown to occupy the full block device. If
216           the file system is already at maximum size, no action will be
217           performed. It is hence expected that this option remains set even
218           after the file system has been grown. Only certain file system
219           types are supported, see systemd-makefs@.service(8) for details.
220
221           Note that this option can only be used in /etc/fstab, and will be
222           ignored when part of the Options= setting in a unit file.
223
224       x-systemd.pcrfs
225           Measures file system identity information (mount point, type,
226           label, UUID, partition label, partition UUID) into PCR 15 after the
227           file system has been mounted. This ensures the systemd-
228           pcrfs@.service(8) or systemd-pcrfs-root.service services are pulled
229           in by the mount unit.
230
231           Note that this option can only be used in /etc/fstab, and will be
232           ignored when part of the Options= setting in a unit file. It is
233           also implied for the root and /usr/ partitions discovered by
234           systemd-gpt-auto-generator(8).
235
236       x-systemd.rw-only
237           If a mount operation fails to mount the file system read-write, it
238           normally tries mounting the file system read-only instead. This
239           option disables that behaviour, and causes the mount to fail
240           immediately instead. This option is translated into the
241           ReadWriteOnly= setting in a unit file.
242
243       _netdev
244           Normally the file system type is used to determine if a mount is a
245           "network mount", i.e. if it should only be started after the
246           network is available. Using this option overrides this detection
247           and specifies that the mount requires network.
248
249           Network mount units are ordered between remote-fs-pre.target and
250           remote-fs.target, instead of local-fs-pre.target and
251           local-fs.target. They also pull in network-online.target and are
252           ordered after it and network.target.
253
254       noauto, auto
255           With noauto, the mount unit will not be added as a dependency for
256           local-fs.target or remote-fs.target. This means that it will not be
257           mounted automatically during boot, unless it is pulled in by some
258           other unit. The auto option has the opposite meaning and is the
259           default.
260
261           Note that if x-systemd.automount (see above) is used, neither auto
262           nor noauto have any effect. The matching automount unit will be
263           added as a dependency to the appropriate target.
264
265       nofail
266           With nofail, this mount will be only wanted, not required, by
267           local-fs.target or remote-fs.target. Moreover the mount unit is not
268           ordered before these target units. This means that the boot will
269           continue without waiting for the mount unit and regardless whether
270           the mount point can be mounted successfully.
271
272       x-initrd.mount
273           An additional filesystem to be mounted in the initrd. See
274           initrd-fs.target description in systemd.special(7). This is both an
275           indicator to the initrd to mount this partition early and an
276           indicator to the host to leave the partition mounted until final
277           shutdown. Or in other words, if this flag is set it is assumed the
278           mount shall be active during the entire regular runtime of the
279           system, i.e. established before the initrd transitions into the
280           host all the way until the host transitions to the final shutdown
281           phase.
282
283       If a mount point is configured in both /etc/fstab and a unit file that
284       is stored below /usr/, the former will take precedence. If the unit
285       file is stored below /etc/, it will take precedence. This means: native
286       unit files take precedence over traditional configuration files, but
287       this is superseded by the rule that configuration in /etc/ will always
288       take precedence over configuration in /usr/.
289

OPTIONS

291       Mount unit files may include [Unit] and [Install] sections, which are
292       described in systemd.unit(5).
293
294       Mount unit files must include a [Mount] section, which carries
295       information about the file system mount points it supervises. A number
296       of options that may be used in this section are shared with other unit
297       types. These options are documented in systemd.exec(5) and
298       systemd.kill(5). The options specific to the [Mount] section of mount
299       units are the following:
300
301       What=
302           Takes an absolute path of a device node, file or other resource to
303           mount. See mount(8) for details. If this refers to a device node, a
304           dependency on the respective device unit is automatically created.
305           (See systemd.device(5) for more information.) This option is
306           mandatory. Note that the usual specifier expansion is applied to
307           this setting, literal percent characters should hence be written as
308           "%%". If this mount is a bind mount and the specified path does not
309           exist yet it is created as directory.
310
311       Where=
312           Takes an absolute path of a file or directory for the mount point;
313           in particular, the destination cannot be a symbolic link. If the
314           mount point does not exist at the time of mounting, it is created
315           as either a directory or a file. The former is the usual case; the
316           latter is done only if this mount is a bind mount and the source
317           (What=) is not a directory. This string must be reflected in the
318           unit filename. (See above.) This option is mandatory.
319
320       Type=
321           Takes a string for the file system type. See mount(8) for details.
322           This setting is optional.
323
324       Options=
325           Mount options to use when mounting. This takes a comma-separated
326           list of options. This setting is optional. Note that the usual
327           specifier expansion is applied to this setting, literal percent
328           characters should hence be written as "%%".
329
330       SloppyOptions=
331           Takes a boolean argument. If true, parsing of the options specified
332           in Options= is relaxed, and unknown mount options are tolerated.
333           This corresponds with mount(8)'s -s switch. Defaults to off.
334
335       LazyUnmount=
336           Takes a boolean argument. If true, detach the filesystem from the
337           filesystem hierarchy at time of the unmount operation, and clean up
338           all references to the filesystem as soon as they are not busy
339           anymore. This corresponds with umount(8)'s -l switch. Defaults to
340           off.
341
342       ReadWriteOnly=
343           Takes a boolean argument. If false, a mount point that shall be
344           mounted read-write but cannot be mounted so is retried to be
345           mounted read-only. If true the operation will fail immediately
346           after the read-write mount attempt did not succeed. This
347           corresponds with mount(8)'s -w switch. Defaults to off.
348
349       ForceUnmount=
350           Takes a boolean argument. If true, force an unmount (in case of an
351           unreachable NFS system). This corresponds with umount(8)'s -f
352           switch. Defaults to off.
353
354       DirectoryMode=
355           Directories of mount points (and any parent directories) are
356           automatically created if needed. This option specifies the file
357           system access mode used when creating these directories. Takes an
358           access mode in octal notation. Defaults to 0755.
359
360       TimeoutSec=
361           Configures the time to wait for the mount command to finish. If a
362           command does not exit within the configured time, the mount will be
363           considered failed and be shut down again. All commands still
364           running will be terminated forcibly via SIGTERM, and after another
365           delay of this time with SIGKILL. (See KillMode= in
366           systemd.kill(5).) Takes a unit-less value in seconds, or a time
367           span value such as "5min 20s". Pass 0 to disable the timeout logic.
368           The default value is set from DefaultTimeoutStartSec= option in
369           systemd-system.conf(5).
370
371       Check systemd.unit(5), systemd.exec(5), and systemd.kill(5) for more
372       settings.
373

SEE ALSO

375       systemd(1), systemctl(1), systemd-system.conf(5), systemd.unit(5),
376       systemd.exec(5), systemd.kill(5), systemd.resource-control(5),
377       systemd.service(5), systemd.device(5), proc(5), mount(8), systemd-
378       fstab-generator(8), systemd.directives(7), systemd-mount(1)
379

NOTES

381        1. API File Systems
382           https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
383
384
385
386systemd 254                                                   SYSTEMD.MOUNT(5)
Impressum