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 instead of
36 a regular mount point is created (i.e. the --automount= option is
37 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 yet. 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 --no-pager
65 Do not pipe output into a pager.
66
67 --no-ask-password
68 Do not query the user for authentication for privileged operations.
69
70 --quiet, -q
71 Suppresses additional informational output while running.
72
73 --discover
74 Enable probing of the mount source. This switch is implied if a
75 single argument is specified on the command line. If passed,
76 additional metadata is read from the device to enhance the unit to
77 create. For example, a descriptive string for the transient units
78 is generated from the file system label and device model. Moreover
79 if a removable block device (e.g. USB stick) is detected an
80 automount unit instead of a regular mount unit is created, with a
81 short idle timeout, in order to ensure the file-system is placed in
82 a clean state quickly after each access.
83
84 --type=, -t
85 Specifies the file system type to mount (e.g. "vfat", "ext4",
86 ...). If omitted (or set to "auto") the file system is determined
87 automatically.
88
89 --options=, -o
90 Additional mount options for the mount point.
91
92 --owner=USER
93 Let the specified user USER own the mounted file system. This is
94 done by appending uid= and gid= options to the list of mount
95 options. Only certain file systems support this option.
96
97 --fsck=
98 Takes a boolean argument, defaults to on. Controls whether to run a
99 file system check immediately before the mount operation. In the
100 automount case (see --automount= below) the check will be run the
101 moment the first access to the device is made, which might slightly
102 delay the access.
103
104 --description=
105 Provide a description for the mount or automount unit. See
106 Description= in systemd.unit(5).
107
108 --property=, -p
109 Sets a unit property for the mount unit that is created. This takes
110 an assignment in the same format as systemctl(1)'s set-property
111 command.
112
113 --automount=
114 Takes a boolean argument. Controls whether to create an automount
115 point or a regular mount point. If true an automount point is
116 created that is backed by the actual file system at the time of
117 first access. If false a plain mount point is created that is
118 backed by the actual file system immediately. Automount points have
119 the benefit that the file system stays unmounted and hence in clean
120 state until it is first accessed. In automount mode the
121 --timeout-idle-sec= switch (see below) may be used to ensure the
122 mount point is unmounted automatically after the last access and an
123 idle period passed.
124
125 If this switch is not specified it defaults to false. If not
126 specified and --discover is used (or only a single argument passed,
127 which implies --discover, see above), and the file system block
128 device is detected to be removable, it is set to true, in order to
129 increase the chance that the file system is in a fully clean state
130 if the device is unplugged abruptly.
131
132 -A
133 Equivalent to --automount=yes.
134
135 --timeout-idle-sec=
136 Takes a time value that controls the idle timeout in automount
137 mode. If set to "infinity" (the default) no automatic unmounts are
138 done. Otherwise the file system backing the automount point is
139 detached after the last access and the idle timeout passed. See
140 systemd.time(7) for details on the time syntax supported. This
141 option has no effect if only a regular mount is established, and
142 automounting is not used.
143
144 Note that if --discover is used (or only a single argument passed,
145 which implies --discover, see above), and the file system block
146 device is detected to be removable, --timeout-idle-sec=1s is
147 implied.
148
149 --automount-property=
150 Similar to --property=, but applies additional properties to the
151 automount unit created, instead of the mount unit.
152
153 --bind-device
154 This option only has an effect in automount mode, and controls
155 whether the automount unit shall be bound to the backing device's
156 lifetime. If set, the automount point will be removed automatically
157 when the backing device vanishes. By default the automount point
158 stays around, and subsequent accesses will block until backing
159 device is replugged. This option has no effect in case of
160 non-device mounts, such as network or virtual file system mounts.
161
162 Note that if --discover is used (or only a single argument passed,
163 which implies --discover, see above), and the file system block
164 device is detected to be removable, this option is implied.
165
166 --list
167 Instead of establishing a mount or automount point, print a terse
168 list of block devices containing file systems that may be mounted
169 with "systemd-mount", along with useful metadata such as labels,
170 etc.
171
172 -u, --umount
173 Stop the mount and automount units corresponding to the specified
174 mount points WHERE or the devices WHAT. systemd-mount with this
175 option or systemd-umount can take multiple arguments which can be
176 mount points, devices, /etc/fstab style node names, or backing
177 files corresponding to loop devices, like systemd-mount --umount
178 /path/to/umount /dev/sda1 UUID=xxxxxx-xxxx LABEL=xxxxx
179 /path/to/disk.img. Note that when -H or -M is specified, only
180 absolute paths to mount points are supported.
181
182 -G, --collect
183 Unload the transient unit after it completed, even if it failed.
184 Normally, without this option, all mount units that mount and
185 failed are kept in memory until the user explicitly resets their
186 failure state with systemctl reset-failed or an equivalent command.
187 On the other hand, units that stopped successfully are unloaded
188 immediately. If this option is turned on the "garbage collection"
189 of units is more aggressive, and unloads units regardless if they
190 exited successfully or failed. This option is a shortcut for
191 --property=CollectMode=inactive-or-failed, see the explanation for
192 CollectMode= in systemd.unit(5) for further information.
193
194 --user
195 Talk to the service manager of the calling user, rather than the
196 service manager of the system.
197
198 --system
199 Talk to the service manager of the system. This is the implied
200 default.
201
202 -H, --host=
203 Execute the operation remotely. Specify a hostname, or a username
204 and hostname separated by "@", to connect to. The hostname may
205 optionally be suffixed by a port ssh is listening on, separated by
206 ":", and then a container name, separated by "/", which connects
207 directly to a specific container on the specified host. This will
208 use SSH to talk to the remote machine manager instance. Container
209 names may be enumerated with machinectl -H HOST. Put IPv6 addresses
210 in brackets.
211
212 -M, --machine=
213 Execute operation on a local container. Specify a container name to
214 connect to.
215
216 -h, --help
217 Print a short help text and exit.
218
219 --version
220 Print a short version string and exit.
221
223 On success, 0 is returned, a non-zero failure code otherwise.
224
226 If --discover is used, systemd-mount honors a couple of additional udev
227 properties of block devices:
228
229 SYSTEMD_MOUNT_OPTIONS=
230 The mount options to use, if --options= is not used.
231
232 SYSTEMD_MOUNT_WHERE=
233 The file system path to place the mount point at, instead of the
234 automatically generated one.
235
237 Use a udev rule like the following to automatically mount all USB
238 storage plugged in:
239
240 ACTION=="add", SUBSYSTEMS=="usb", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", \
241 RUN{program}+="/usr/bin/systemd-mount --no-block --automount=yes --collect $devnode"
242
244 systemd(1), mount(8), systemctl(1), systemd.unit(5), systemd.mount(5),
245 systemd.automount(5), systemd-run(1)
246
247
248
249systemd 243 SYSTEMD-MOUNT(1)