1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
|
'\" t
.TH "SYSTEMD\-MOUNT" "1" "" "systemd 256~rc3" "systemd-mount"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
systemd-mount, systemd-umount \- Establish and destroy transient mount or auto\-mount points
.SH "SYNOPSIS"
.HP \w'\fBsystemd\-mount\fR\ 'u
\fBsystemd\-mount\fR [\fIOPTIONS\fR...] \fIWHAT\fR [\fIWHERE\fR]
.HP \w'\fBsystemd\-mount\fR\ 'u
\fBsystemd\-mount\fR [\fIOPTIONS\fR...] \fB\-\-tmpfs\fR [\fINAME\fR] \fIWHERE\fR
.HP \w'\fBsystemd\-mount\fR\ 'u
\fBsystemd\-mount\fR [\fIOPTIONS\fR...] \fB\-\-list\fR
.HP \w'\fBsystemd\-mount\fR\ 'u
\fBsystemd\-mount\fR [\fIOPTIONS\fR...] \fB\-\-umount\fR \fIWHAT|WHERE\fR...
.SH "DESCRIPTION"
.PP
\fBsystemd\-mount\fR
may be used to create and start a transient
\&.mount
or
\&.automount
unit of the file system
\fIWHAT\fR
on the mount point
\fIWHERE\fR\&.
.PP
In many ways,
\fBsystemd\-mount\fR
is similar to the lower\-level
\fBmount\fR(8)
command, however instead of executing the mount operation directly and immediately,
\fBsystemd\-mount\fR
schedules it through the service manager job queue, so that it may pull in further dependencies (such as parent mounts, or a file system checker to execute a priori), and may make use of the auto\-mounting logic\&.
.PP
The command takes either one or two arguments\&. If only one argument is specified it should refer to a block device or regular file containing a file system (e\&.g\&.
"/dev/sdb1"
or
"/path/to/disk\&.img")\&. The block device or image file is then probed for a file system label and other metadata, and is mounted to a directory below
/run/media/system/
whose name is generated from the file system label\&. In this mode the block device or image file must exist at the time of invocation of the command, so that it may be probed\&. If the device is found to be a removable block device (e\&.g\&. a USB stick), an automount point is created instead of a regular mount point (i\&.e\&. the
\fB\-\-automount=\fR
option is implied, see below)\&. If the option
\fB\-\-tmpfs\fR
is specified, then the argument is interpreted as the path where the new temporary file system shall be mounted\&.
.PP
If two arguments are specified, the first indicates the mount source (the
\fIWHAT\fR) and the second indicates the path to mount it on (the
\fIWHERE\fR)\&. In this mode no probing of the source is attempted, and a backing device node doesn\*(Aqt have to exist\&. However, if this mode is combined with
\fB\-\-discover\fR, device node probing for additional metadata is enabled, and \(en much like in the single\-argument case discussed above \(en the specified device has to exist at the time of invocation of the command\&.
.PP
Use the
\fB\-\-list\fR
command to show a terse table of all local, known block devices with file systems that may be mounted with this command\&.
.PP
\fBsystemd\-umount\fR
can be used to unmount a mount or automount point\&. It is the same as
\fBsystemd\-mount\fR
\fB\-\-umount\fR\&.
.SH "OPTIONS"
.PP
The following options are understood:
.PP
\fB\-\-no\-block\fR
.RS 4
Do not synchronously wait for the requested operation to finish\&. If this is not specified, the job will be verified, enqueued and
\fBsystemd\-mount\fR
will wait until the mount or automount unit\*(Aqs start\-up is completed\&. By passing this argument, it is only verified and enqueued\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-l\fR, \fB\-\-full\fR
.RS 4
Do not ellipsize the output when
\fB\-\-list\fR
is specified\&.
.sp
Added in version 245\&.
.RE
.PP
\fB\-\-no\-pager\fR
.RS 4
Do not pipe output into a pager\&.
.RE
.PP
\fB\-\-no\-legend\fR
.RS 4
Do not print the legend, i\&.e\&. column headers and the footer with hints\&.
.RE
.PP
\fB\-\-no\-ask\-password\fR
.RS 4
Do not query the user for authentication for privileged operations\&.
.RE
.PP
\fB\-\-quiet\fR, \fB\-q\fR
.RS 4
Suppresses additional informational output while running\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-discover\fR
.RS 4
Enable probing of the mount source\&. This switch is implied if a single argument is specified on the command line\&. If passed, additional metadata is read from the device to enhance the unit to create\&. For example, a descriptive string for the transient units is generated from the file system label and device model\&. Moreover if a removable block device (e\&.g\&. USB stick) is detected an automount unit instead of a regular mount unit is created, with a short idle timeout, in order to ensure the file\-system is placed in a clean state quickly after each access\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-type=\fR, \fB\-t\fR
.RS 4
Specifies the file system type to mount (e\&.g\&.
"vfat"
or
"ext4")\&. If omitted or set to
"auto", the file system type is determined automatically\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-options=\fR, \fB\-o\fR
.RS 4
Additional mount options for the mount point\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-owner=\fR\fB\fIUSER\fR\fR
.RS 4
Let the specified user
\fIUSER\fR
own the mounted file system\&. This is done by appending
\fBuid=\fR
and
\fBgid=\fR
options to the list of mount options\&. Only certain file systems support this option\&.
.sp
Added in version 237\&.
.RE
.PP
\fB\-\-fsck=\fR
.RS 4
Takes a boolean argument, defaults to on\&. Controls whether to run a file system check immediately before the mount operation\&. In the automount case (see
\fB\-\-automount=\fR
below) the check will be run the moment the first access to the device is made, which might slightly delay the access\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-description=\fR
.RS 4
Provide a description for the mount or automount unit\&. See
\fIDescription=\fR
in
\fBsystemd.unit\fR(5)\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-property=\fR, \fB\-p\fR
.RS 4
Sets a unit property for the mount unit that is created\&. This takes an assignment in the same format as
\fBsystemctl\fR(1)\*(Aqs
\fBset\-property\fR
command\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-automount=\fR
.RS 4
Takes a boolean argument\&. Controls whether to create an automount point or a regular mount point\&. If true an automount point is created that is backed by the actual file system at the time of first access\&. If false a plain mount point is created that is backed by the actual file system immediately\&. Automount points have the benefit that the file system stays unmounted and hence in clean state until it is first accessed\&. In automount mode the
\fB\-\-timeout\-idle\-sec=\fR
switch (see below) may be used to ensure the mount point is unmounted automatically after the last access and an idle period passed\&.
.sp
If this switch is not specified it defaults to false\&. If not specified and
\fB\-\-discover\fR
is used (or only a single argument passed, which implies
\fB\-\-discover\fR, see above), and the file system block device is detected to be removable, it is set to true, in order to increase the chance that the file system is in a fully clean state if the device is unplugged abruptly\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-A\fR
.RS 4
Equivalent to
\fB\-\-automount=yes\fR\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-timeout\-idle\-sec=\fR
.RS 4
Takes a time value that controls the idle timeout in automount mode\&. If set to
"infinity"
(the default) no automatic unmounts are done\&. Otherwise the file system backing the automount point is detached after the last access and the idle timeout passed\&. See
\fBsystemd.time\fR(7)
for details on the time syntax supported\&. This option has no effect if only a regular mount is established, and automounting is not used\&.
.sp
Note that if
\fB\-\-discover\fR
is used (or only a single argument passed, which implies
\fB\-\-discover\fR, see above), and the file system block device is detected to be removable,
\fB\-\-timeout\-idle\-sec=1s\fR
is implied\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-automount\-property=\fR
.RS 4
Similar to
\fB\-\-property=\fR, but applies additional properties to the automount unit created, instead of the mount unit\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-bind\-device\fR
.RS 4
This option only has an effect in automount mode, and controls whether the automount unit shall be bound to the backing device\*(Aqs lifetime\&. If set, the automount unit will be stopped automatically when the backing device vanishes\&. By default the automount unit stays around, and subsequent accesses will block until backing device is replugged\&. This option has no effect in case of non\-device mounts, such as network or virtual file system mounts\&.
.sp
Note that if
\fB\-\-discover\fR
is used (or only a single argument passed, which implies
\fB\-\-discover\fR, see above), and the file system block device is detected to be removable, this option is implied\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-\-list\fR
.RS 4
Instead of establishing a mount or automount point, print a terse list of block devices containing file systems that may be mounted with
"systemd\-mount", along with useful metadata such as labels, etc\&.
.sp
Added in version 232\&.
.RE
.PP
\fB\-u\fR, \fB\-\-umount\fR
.RS 4
Stop the mount and automount units corresponding to the specified mount points
\fIWHERE\fR
or the devices
\fIWHAT\fR\&.
\fBsystemd\-mount\fR
with this option or
\fBsystemd\-umount\fR
can take multiple arguments which can be mount points, devices,
/etc/fstab
style node names, or backing files corresponding to loop devices, like
\fBsystemd\-mount \-\-umount /path/to/umount /dev/sda1 UUID=xxxxxx\-xxxx LABEL=xxxxx /path/to/disk\&.img\fR\&. Note that when
\fB\-H\fR
or
\fB\-M\fR
is specified, only absolute paths to mount points are supported\&.
.sp
Added in version 233\&.
.RE
.PP
\fB\-G\fR, \fB\-\-collect\fR
.RS 4
Unload the transient unit after it completed, even if it failed\&. Normally, without this option, all mount units that mount and failed are kept in memory until the user explicitly resets their failure state with
\fBsystemctl reset\-failed\fR
or an equivalent command\&. On the other hand, units that stopped successfully are unloaded immediately\&. If this option is turned on the "garbage collection" of units is more aggressive, and unloads units regardless if they exited successfully or failed\&. This option is a shortcut for
\fB\-\-property=CollectMode=inactive\-or\-failed\fR, see the explanation for
\fICollectMode=\fR
in
\fBsystemd.unit\fR(5)
for further information\&.
.sp
Added in version 236\&.
.RE
.PP
\fB\-T\fR, \fB\-\-tmpfs\fR
.RS 4
Create and mount a new
\fBtmpfs\fR
file system on
\fIWHERE\fR, with an optional
\fINAME\fR
that defaults to
"tmpfs"\&.
.sp
The file system is mounted with the top\-level directory mode determined by the
\fBumask\fR(2)
setting of the caller, i\&.e\&.
\fBrwxrwxrwx\fR
masked by the umask of the caller\&. This matches what
\fBmkdir\fR(1)
does, but is different from the kernel default of
"rwxrwxrwxt", i\&.e\&. a world\-writable directory with the sticky bit set\&.
.sp
Added in version 255\&.
.RE
.PP
\fB\-\-user\fR
.RS 4
Talk to the service manager of the calling user, rather than the service manager of the system\&.
.RE
.PP
\fB\-\-system\fR
.RS 4
Talk to the service manager of the system\&. This is the implied default\&.
.RE
.PP
\fB\-H\fR, \fB\-\-host=\fR
.RS 4
Execute the operation remotely\&. Specify a hostname, or a username and hostname separated by
"@", to connect to\&. The hostname may optionally be suffixed by a port ssh is listening on, separated by
":", and then a container name, separated by
"/", which connects directly to a specific container on the specified host\&. This will use SSH to talk to the remote machine manager instance\&. Container names may be enumerated with
\fBmachinectl \-H \fR\fB\fIHOST\fR\fR\&. Put IPv6 addresses in brackets\&.
.RE
.PP
\fB\-M\fR, \fB\-\-machine=\fR
.RS 4
Execute operation on a local container\&. Specify a container name to connect to, optionally prefixed by a user name to connect as and a separating
"@"
character\&. If the special string
"\&.host"
is used in place of the container name, a connection to the local system is made (which is useful to connect to a specific user\*(Aqs user bus:
"\-\-user \-\-machine=lennart@\&.host")\&. If the
"@"
syntax is not used, the connection is made as root user\&. If the
"@"
syntax is used either the left hand side or the right hand side may be omitted (but not both) in which case the local user name and
"\&.host"
are implied\&.
.RE
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Print a short help text and exit\&.
.RE
.PP
\fB\-\-version\fR
.RS 4
Print a short version string and exit\&.
.RE
.SH "EXIT STATUS"
.PP
On success, 0 is returned, a non\-zero failure code otherwise\&.
.SH "THE UDEV DATABASE"
.PP
If
\fB\-\-discover\fR
is used,
\fBsystemd\-mount\fR
honors a couple of additional udev properties of block devices:
.PP
\fISYSTEMD_MOUNT_OPTIONS=\fR
.RS 4
The mount options to use, if
\fB\-\-options=\fR
is not used\&.
.sp
Added in version 232\&.
.RE
.PP
\fISYSTEMD_MOUNT_WHERE=\fR
.RS 4
The file system path to place the mount point at, instead of the automatically generated one\&.
.sp
Added in version 232\&.
.RE
.SH "EXAMPLE"
.PP
Use a udev rule like the following to automatically mount all USB storage plugged in:
.sp
.if n \{\
.RS 4
.\}
.nf
ACTION=="add", SUBSYSTEMS=="usb", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", \e
RUN{program}+="/usr/bin/systemd\-mount \-\-no\-block \-\-automount=yes \-\-collect $devnode"
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1), \fBmount\fR(8), \fBsystemctl\fR(1), \fBsystemd.unit\fR(5), \fBsystemd.mount\fR(5), \fBsystemd.automount\fR(5), \fBsystemd-run\fR(1)
|