1SYSTEMD-MOUNT(1) systemd-mount SYSTEMD-MOUNT(1)
2
3
4
6 systemd-mount, systemd-umount - Establish and destroy transient mount
7 or auto-mount points
8
10 systemd-mount [OPTIONS...] WHAT [WHERE]
11
12 systemd-mount [OPTIONS...] --list
13
14 systemd-mount [OPTIONS...] --umount WHAT|WHERE...
15
17 systemd-mount may be used to create and start a transient .mount or
18 .automount unit of the file system WHAT on the mount point WHERE.
19
20 In many ways, systemd-mount is similar to the lower-level mount(8)
21 command, however instead of executing the mount operation directly and
22 immediately, systemd-mount schedules it through the service manager job
23 queue, so that it may pull in further dependencies (such as parent
24 mounts, or a file system checker to execute a priori), and may make use
25 of the auto-mounting logic.
26
27 The command takes either one or two arguments. If only one argument is
28 specified it should refer to a block device or regular file containing
29 a file system (e.g. "/dev/sdb1" or "/path/to/disk.img"). The block
30 device or image file is then probed for a file system label and other
31 metadata, and is mounted to a directory below /run/media/system/ whose
32 name is generated from the file system label. In this mode the block
33 device or image file must exist at the time of invocation of the
34 command, so that it may be probed. If the device is found to be a
35 removable block device (e.g. a USB stick), an automount point is
36 created instead of a regular mount point (i.e. the --automount= option
37 is implied, see below).
38
39 If two arguments are specified, the first indicates the mount source
40 (the WHAT) and the second indicates the path to mount it on (the
41 WHERE). In this mode no probing of the source is attempted, and a
42 backing device node doesn't have to exist. However, if this mode is
43 combined with --discover, device node probing for additional metadata
44 is enabled, and – much like in the single-argument case discussed above
45 – the specified device has to exist at the time of invocation of the
46 command.
47
48 Use the --list command to show a terse table of all local, known block
49 devices with file systems that may be mounted with this command.
50
51 systemd-umount can be used to unmount a mount or automount point. It is
52 the same as systemd-mount --umount.
53
55 The following options are understood:
56
57 --no-block
58 Do not synchronously wait for the requested operation to finish. If
59 this is not specified, the job will be verified, enqueued and
60 systemd-mount will wait until the mount or automount unit's
61 start-up is completed. By passing this argument, it is only
62 verified and enqueued.
63
64 -l, --full
65 Do not ellipsize the output when --list is specified.
66
67 --no-pager
68 Do not pipe output into a pager.
69
70 --no-legend
71 Do not print the legend, i.e. column headers and the footer with
72 hints.
73
74 --no-ask-password
75 Do not query the user for authentication for privileged operations.
76
77 --quiet, -q
78 Suppresses additional informational output while running.
79
80 --discover
81 Enable probing of the mount source. This switch is implied if a
82 single argument is specified on the command line. If passed,
83 additional metadata is read from the device to enhance the unit to
84 create. For example, a descriptive string for the transient units
85 is generated from the file system label and device model. Moreover
86 if a removable block device (e.g. USB stick) is detected an
87 automount unit instead of a regular mount unit is created, with a
88 short idle timeout, in order to ensure the file-system is placed in
89 a clean state quickly after each access.
90
91 --type=, -t
92 Specifies the file system type to mount (e.g. "vfat" or "ext4").
93 If omitted or set to "auto", the file system type is determined
94 automatically.
95
96 --options=, -o
97 Additional mount options for the mount point.
98
99 --owner=USER
100 Let the specified user USER own the mounted file system. This is
101 done by appending uid= and gid= options to the list of mount
102 options. Only certain file systems support this option.
103
104 --fsck=
105 Takes a boolean argument, defaults to on. Controls whether to run a
106 file system check immediately before the mount operation. In the
107 automount case (see --automount= below) the check will be run the
108 moment the first access to the device is made, which might slightly
109 delay the access.
110
111 --description=
112 Provide a description for the mount or automount unit. See
113 Description= in systemd.unit(5).
114
115 --property=, -p
116 Sets a unit property for the mount unit that is created. This takes
117 an assignment in the same format as systemctl(1)'s set-property
118 command.
119
120 --automount=
121 Takes a boolean argument. Controls whether to create an automount
122 point or a regular mount point. If true an automount point is
123 created that is backed by the actual file system at the time of
124 first access. If false a plain mount point is created that is
125 backed by the actual file system immediately. Automount points have
126 the benefit that the file system stays unmounted and hence in clean
127 state until it is first accessed. In automount mode the
128 --timeout-idle-sec= switch (see below) may be used to ensure the
129 mount point is unmounted automatically after the last access and an
130 idle period passed.
131
132 If this switch is not specified it defaults to false. If not
133 specified and --discover is used (or only a single argument passed,
134 which implies --discover, see above), and the file system block
135 device is detected to be removable, it is set to true, in order to
136 increase the chance that the file system is in a fully clean state
137 if the device is unplugged abruptly.
138
139 -A
140 Equivalent to --automount=yes.
141
142 --timeout-idle-sec=
143 Takes a time value that controls the idle timeout in automount
144 mode. If set to "infinity" (the default) no automatic unmounts are
145 done. Otherwise the file system backing the automount point is
146 detached after the last access and the idle timeout passed. See
147 systemd.time(7) for details on the time syntax supported. This
148 option has no effect if only a regular mount is established, and
149 automounting is not used.
150
151 Note that if --discover is used (or only a single argument passed,
152 which implies --discover, see above), and the file system block
153 device is detected to be removable, --timeout-idle-sec=1s is
154 implied.
155
156 --automount-property=
157 Similar to --property=, but applies additional properties to the
158 automount unit created, instead of the mount unit.
159
160 --bind-device
161 This option only has an effect in automount mode, and controls
162 whether the automount unit shall be bound to the backing device's
163 lifetime. If set, the automount point will be removed automatically
164 when the backing device vanishes. By default the automount point
165 stays around, and subsequent accesses will block until backing
166 device is replugged. This option has no effect in case of
167 non-device mounts, such as network or virtual file system mounts.
168
169 Note that if --discover is used (or only a single argument passed,
170 which implies --discover, see above), and the file system block
171 device is detected to be removable, this option is implied.
172
173 --list
174 Instead of establishing a mount or automount point, print a terse
175 list of block devices containing file systems that may be mounted
176 with "systemd-mount", along with useful metadata such as labels,
177 etc.
178
179 -u, --umount
180 Stop the mount and automount units corresponding to the specified
181 mount points WHERE or the devices WHAT. systemd-mount with this
182 option or systemd-umount can take multiple arguments which can be
183 mount points, devices, /etc/fstab style node names, or backing
184 files corresponding to loop devices, like systemd-mount --umount
185 /path/to/umount /dev/sda1 UUID=xxxxxx-xxxx LABEL=xxxxx
186 /path/to/disk.img. Note that when -H or -M is specified, only
187 absolute paths to mount points are supported.
188
189 -G, --collect
190 Unload the transient unit after it completed, even if it failed.
191 Normally, without this option, all mount units that mount and
192 failed are kept in memory until the user explicitly resets their
193 failure state with systemctl reset-failed or an equivalent command.
194 On the other hand, units that stopped successfully are unloaded
195 immediately. If this option is turned on the "garbage collection"
196 of units is more aggressive, and unloads units regardless if they
197 exited successfully or failed. This option is a shortcut for
198 --property=CollectMode=inactive-or-failed, see the explanation for
199 CollectMode= in systemd.unit(5) for further information.
200
201 --user
202 Talk to the service manager of the calling user, rather than the
203 service manager of the system.
204
205 --system
206 Talk to the service manager of the system. This is the implied
207 default.
208
209 -H, --host=
210 Execute the operation remotely. Specify a hostname, or a username
211 and hostname separated by "@", to connect to. The hostname may
212 optionally be suffixed by a port ssh is listening on, separated by
213 ":", and then a container name, separated by "/", which connects
214 directly to a specific container on the specified host. This will
215 use SSH to talk to the remote machine manager instance. Container
216 names may be enumerated with machinectl -H HOST. Put IPv6 addresses
217 in brackets.
218
219 -M, --machine=
220 Execute operation on a local container. Specify a container name to
221 connect to, optionally prefixed by a user name to connect as and a
222 separating "@" character. If the special string ".host" is used in
223 place of the container name, a connection to the local system is
224 made (which is useful to connect to a specific user's user bus:
225 "--user --machine=lennart@.host"). If the "@" syntax is not used,
226 the connection is made as root user. If the "@" syntax is used
227 either the left hand side or the right hand side may be omitted
228 (but not both) in which case the local user name and ".host" are
229 implied.
230
231 -h, --help
232 Print a short help text and exit.
233
234 --version
235 Print a short version string and exit.
236
238 On success, 0 is returned, a non-zero failure code otherwise.
239
241 If --discover is used, systemd-mount honors a couple of additional udev
242 properties of block devices:
243
244 SYSTEMD_MOUNT_OPTIONS=
245 The mount options to use, if --options= is not used.
246
247 SYSTEMD_MOUNT_WHERE=
248 The file system path to place the mount point at, instead of the
249 automatically generated one.
250
252 Use a udev rule like the following to automatically mount all USB
253 storage plugged in:
254
255 ACTION=="add", SUBSYSTEMS=="usb", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", \
256 RUN{program}+="/usr/bin/systemd-mount --no-block --automount=yes --collect $devnode"
257
259 systemd(1), mount(8), systemctl(1), systemd.unit(5), systemd.mount(5),
260 systemd.automount(5), systemd-run(1)
261
262
263
264systemd 251 SYSTEMD-MOUNT(1)