1SYSTEMD.MOUNT(5) systemd.mount SYSTEMD.MOUNT(5)
2
3
4
6 systemd.mount - Mount unit configuration
7
9 mount.mount
10
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 additional symlinks to it.
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
53 Implicit Dependencies
54 The following dependencies are implicitly added:
55
56 · If a mount unit is beneath another mount unit in the file system
57 hierarchy, both a requirement dependency and an ordering dependency
58 between both units are created automatically.
59
60 · Block device backed file systems automatically gain BindsTo= and
61 After= type dependencies on the device unit encapsulating the block
62 device (see below).
63
64 · If traditional file system quota is enabled for a mount unit,
65 automatic Wants= and Before= dependencies on
66 systemd-quotacheck.service and quotaon.service are added.
67
68 · Additional implicit dependencies may be added as result of
69 execution and resource control parameters as documented in
70 systemd.exec(5) and systemd.resource-control(5).
71
72 Default Dependencies
73 The following dependencies are added unless DefaultDependencies=no is
74 set:
75
76 · All mount units acquire automatic Before= and Conflicts= on
77 umount.target in order to be stopped during shutdown.
78
79 · Mount units referring to local file systems automatically gain an
80 After= dependency on local-fs-pre.target, and a Before= dependency
81 on local-fs.target unless nofail mount option is set.
82
83 · Network mount units automatically acquire After= dependencies on
84 remote-fs-pre.target, network.target and network-online.target, and
85 gain a Before= dependency on remote-fs.target unless nofail mount
86 option is set. Towards the latter a Wants= unit is added as well.
87
88 Mount units referring to local and network file systems are
89 distinguished by their file system type specification. In some cases
90 this is not sufficient (for example network block device based mounts,
91 such as iSCSI), in which case _netdev may be added to the mount option
92 string of the unit, which forces systemd to consider the mount unit a
93 network mount.
94
96 Mount units may either be configured via unit files, or via /etc/fstab
97 (see fstab(5) for details). Mounts listed in /etc/fstab will be
98 converted into native units dynamically at boot and when the
99 configuration of the system manager is reloaded. In general,
100 configuring mount points through /etc/fstab is the preferred approach.
101 See systemd-fstab-generator(8) for details about the conversion.
102
103 The NFS mount option bg for NFS background mounts as documented in
104 nfs(5) is detected by systemd-fstab-generator and the options are
105 transformed so that systemd fulfills the job-control implications of
106 that option. Specifically systemd-fstab-generator acts as though
107 "x-systemd.mount-timeout=infinity,retry=10000" was prepended to the
108 option list, and "fg,nofail" was appended. Depending on specific
109 requirements, it may be appropriate to provide some of these options
110 explicitly, or to make use of the "x-systemd.automount" option
111 described below instead of using "bg".
112
113 When reading /etc/fstab a few special mount options are understood by
114 systemd which influence how dependencies are created for mount points.
115 systemd will create a dependency of type Wants= or Requires (see option
116 nofail below), from either local-fs.target or remote-fs.target,
117 depending whether the file system is local or remote.
118
119 x-systemd.requires=
120 Configures a Requires= and an After= dependency between the created
121 mount unit and another systemd unit, such as a device or mount
122 unit. The argument should be a unit name, or an absolute path to a
123 device node or mount point. This option may be specified more than
124 once. This option is particularly useful for mount point
125 declarations that need an additional device to be around (such as
126 an external journal device for journal file systems) or an
127 additional mount to be in place (such as an overlay file system
128 that merges multiple mount points). See After= and Requires= in
129 systemd.unit(5) for details.
130
131 x-systemd.before=, x-systemd.after=
132 Configures a Before= dependency or After= between the created mount
133 unit and another systemd unit, such as a mount unit. The argument
134 should be a unit name or an absolute path to a mount point. This
135 option may be specified more than once. This option is particularly
136 useful for mount point declarations with nofail option that are
137 mounted asynchronously but need to be mounted before or after some
138 unit start, for example, before local-fs.target unit. See Before=
139 and After= in systemd.unit(5) for details.
140
141 x-systemd.requires-mounts-for=
142 Configures a RequiresMountsFor= dependency between the created
143 mount unit and other mount units. The argument must be an absolute
144 path. This option may be specified more than once. See
145 RequiresMountsFor= in systemd.unit(5) for details.
146
147 x-systemd.device-bound
148 The block device backed file system will be upgraded to BindsTo=
149 dependency. This option is only useful when mounting file systems
150 manually with mount(8) as the default dependency in this case is
151 Requires=. This option is already implied by entries in /etc/fstab
152 or by mount units.
153
154 x-systemd.automount
155 An automount unit will be created for the file system. See
156 systemd.automount(5) for details.
157
158 x-systemd.idle-timeout=
159 Configures the idle timeout of the automount unit. See
160 TimeoutIdleSec= in systemd.automount(5) for details.
161
162 x-systemd.device-timeout=
163 Configure how long systemd should wait for a device to show up
164 before giving up on an entry from /etc/fstab. Specify a time in
165 seconds or explicitly append a unit such as "s", "min", "h", "ms".
166
167 Note that this option can only be used in /etc/fstab, and will be
168 ignored when part of the Options= setting in a unit file.
169
170 x-systemd.mount-timeout=
171 Configure how long systemd should wait for the mount command to
172 finish before giving up on an entry from /etc/fstab. Specify a time
173 in seconds or explicitly append a unit such as "s", "min", "h",
174 "ms".
175
176 Note that this option can only be used in /etc/fstab, and will be
177 ignored when part of the Options= setting in a unit file.
178
179 See TimeoutSec= below for details.
180
181 x-systemd.makefs
182 The file system will be initialized on the device. If the device is
183 not "empty", i.e. it contains any signature, the operation will be
184 skipped. It is hence expected that this option remains set even
185 after the device has been initalized.
186
187 Note that this option can only be used in /etc/fstab, and will be
188 ignored when part of the Options= setting in a unit file.
189
190 See systemd-makefs@.service(8).
191
192 wipefs(8) may be used to remove any signatures from a block device
193 to force x-systemd.makefs to reinitialize the device.
194
195 x-systemd.growfs
196 The file system will be grown to occupy the full block device. If
197 the file system is already at maximum size, no action will be
198 performed. It is hence expected that this option remains set even
199 after the file system has been grown. Only certain file system
200 types are supported, see systemd-makefs@.service(8) for details.
201
202 Note that this option can only be used in /etc/fstab, and will be
203 ignored when part of the Options= setting in a unit file.
204
205 _netdev
206 Normally the file system type is used to determine if a mount is a
207 "network mount", i.e. if it should only be started after the
208 network is available. Using this option overrides this detection
209 and specifies that the mount requires network.
210
211 Network mount units are ordered between remote-fs-pre.target and
212 remote-fs.target, instead of local-fs-pre.target and
213 local-fs.target. They also pull in network-online.target and are
214 ordered after it and network.target.
215
216 noauto, auto
217 With noauto, the mount unit will not be added as a dependency for
218 local-fs.target or remote-fs.target. This means that it will not be
219 mounted automatically during boot, unless it is pulled in by some
220 other unit. The auto option has the opposite meaning and is the
221 default. Note that the noauto option has an effect on the mount
222 unit itself only — if x-systemd.automount is used (see above), then
223 the matching automount unit will still be pulled in by these
224 targets.
225
226 nofail
227 With nofail, this mount will be only wanted, not required, by
228 local-fs.target or remote-fs.target. Moreover the mount unit is not
229 ordered before these target units. This means that the boot will
230 continue without waiting for the mount unit and regardless whether
231 the mount point can be mounted successfully.
232
233 x-initrd.mount
234 An additional filesystem to be mounted in the initramfs. See
235 initrd-fs.target description in systemd.special(7).
236
237 If a mount point is configured in both /etc/fstab and a unit file that
238 is stored below /usr, the former will take precedence. If the unit file
239 is stored below /etc, it will take precedence. This means: native unit
240 files take precedence over traditional configuration files, but this is
241 superseded by the rule that configuration in /etc will always take
242 precedence over configuration in /usr.
243
245 Mount files must include a [Mount] section, which carries information
246 about the file system mount points it supervises. A number of options
247 that may be used in this section are shared with other unit types.
248 These options are documented in systemd.exec(5) and systemd.kill(5).
249 The options specific to the [Mount] section of mount units are the
250 following:
251
252 What=
253 Takes an absolute path of a device node, file or other resource to
254 mount. See mount(8) for details. If this refers to a device node, a
255 dependency on the respective device unit is automatically created.
256 (See systemd.device(5) for more information.) This option is
257 mandatory. Note that the usual specifier expansion is applied to
258 this setting, literal percent characters should hence be written as
259 "%%".
260
261 Where=
262 Takes an absolute path of a directory for the mount point; in
263 particular, the destination cannot be a symbolic link. If the mount
264 point does not exist at the time of mounting, it is created. This
265 string must be reflected in the unit filename. (See above.) This
266 option is mandatory.
267
268 Type=
269 Takes a string for the file system type. See mount(8) for details.
270 This setting is optional.
271
272 Options=
273 Mount options to use when mounting. This takes a comma-separated
274 list of options. This setting is optional. Note that the usual
275 specifier expansion is applied to this setting, literal percent
276 characters should hence be written as "%%".
277
278 SloppyOptions=
279 Takes a boolean argument. If true, parsing of the options specified
280 in Options= is relaxed, and unknown mount options are tolerated.
281 This corresponds with mount(8)'s -s switch. Defaults to off.
282
283 LazyUnmount=
284 Takes a boolean argument. If true, detach the filesystem from the
285 filesystem hierarchy at time of the unmount operation, and clean up
286 all references to the filesystem as soon as they are not busy
287 anymore. This corresponds with umount(8)'s -l switch. Defaults to
288 off.
289
290 ForceUnmount=
291 Takes a boolean argument. If true, force an unmount (in case of an
292 unreachable NFS system). This corresponds with umount(8)'s -f
293 switch. Defaults to off.
294
295 DirectoryMode=
296 Directories of mount points (and any parent directories) are
297 automatically created if needed. This option specifies the file
298 system access mode used when creating these directories. Takes an
299 access mode in octal notation. Defaults to 0755.
300
301 TimeoutSec=
302 Configures the time to wait for the mount command to finish. If a
303 command does not exit within the configured time, the mount will be
304 considered failed and be shut down again. All commands still
305 running will be terminated forcibly via SIGTERM, and after another
306 delay of this time with SIGKILL. (See KillMode= in
307 systemd.kill(5).) Takes a unit-less value in seconds, or a time
308 span value such as "5min 20s". Pass 0 to disable the timeout logic.
309 The default value is set from DefaultTimeoutStartSec= option in
310 systemd-system.conf(5).
311
312 Check systemd.exec(5) and systemd.kill(5) for more settings.
313
315 systemd(1), systemctl(1), systemd-system.conf(5), systemd.unit(5),
316 systemd.exec(5), systemd.kill(5), systemd.resource-control(5),
317 systemd.service(5), systemd.device(5), proc(5), mount(8), systemd-
318 fstab-generator(8), systemd.directives(7)
319
321 1. API File Systems
322 https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
323
324
325
326systemd 241 SYSTEMD.MOUNT(5)