1SYSTEMD-MOUNT(1)                 systemd-mount                SYSTEMD-MOUNT(1)
2
3
4

NAME

6       systemd-mount, systemd-umount - Establish and destroy transient mount
7       or auto-mount points
8

SYNOPSIS

10       systemd-mount [OPTIONS...] WHAT [WHERE]
11
12       systemd-mount [OPTIONS...] --list
13
14       systemd-mount [OPTIONS...] --umount WHAT|WHERE...
15

DESCRIPTION

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

OPTIONS

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           Takes a boolean argument, defaults to off. This option only has an
155           effect in automount mode, and controls whether the automount unit
156           shall be bound to the backing device's lifetime. If enabled, the
157           automount point will be removed automatically when the backing
158           device vanishes. If disabled the automount point stays around, and
159           subsequent accesses will block until backing device is replugged.
160           This option has no effect in case of non-device mounts, such as
161           network or virtual file system mounts.
162
163           Note that if --discover is used (or only a single argument passed,
164           which implies --discover, see above), and the file system block
165           device is detected to be removable, this option is implied.
166
167       --list
168           Instead of establishing a mount or automount point, print a terse
169           list of block devices containing file systems that may be mounted
170           with "systemd-mount", along with useful metadata such as labels,
171           etc.
172
173       -u, --umount
174           Stop the mount and automount units corresponding to the specified
175           mount points WHERE or the devices WHAT.  systemd-mount with this
176           option or systemd-umount can take multiple arguments which can be
177           mount points, devices, /etc/fstab style node names, or backing
178           files corresponding to loop devices, like systemd-mount --umount
179           /path/to/umount /dev/sda1 UUID=xxxxxx-xxxx LABEL=xxxxx
180           /path/to/disk.img. Note that when -H or -M is specified, only
181           absolute paths to mount points are supported.
182
183       -G, --collect
184           Unload the transient unit after it completed, even if it failed.
185           Normally, without this option, all mount units that mount and
186           failed are kept in memory until the user explicitly resets their
187           failure state with systemctl reset-failed or an equivalent command.
188           On the other hand, units that stopped successfully are unloaded
189           immediately. If this option is turned on the "garbage collection"
190           of units is more aggressive, and unloads units regardless if they
191           exited successfully or failed. This option is a shortcut for
192           --property=CollectMode=inactive-or-failed, see the explanation for
193           CollectMode= in systemd.unit(5) for further information.
194
195       --user
196           Talk to the service manager of the calling user, rather than the
197           service manager of the system.
198
199       --system
200           Talk to the service manager of the system. This is the implied
201           default.
202
203       -H, --host=
204           Execute the operation remotely. Specify a hostname, or a username
205           and hostname separated by "@", to connect to. The hostname may
206           optionally be suffixed by a port ssh is listening on, seperated by
207           ":", and then a container name, separated by "/", which connects
208           directly to a specific container on the specified host. This will
209           use SSH to talk to the remote machine manager instance. Container
210           names may be enumerated with machinectl -H HOST. Put IPv6 addresses
211           in brackets.
212
213       -M, --machine=
214           Execute operation on a local container. Specify a container name to
215           connect to.
216
217       -h, --help
218           Print a short help text and exit.
219
220       --version
221           Print a short version string and exit.
222

EXIT STATUS

224       On success, 0 is returned, a non-zero failure code otherwise.
225

THE UDEV DATABASE

227       If --discover is used, systemd-mount honors a couple of additional udev
228       properties of block devices:
229
230       SYSTEMD_MOUNT_OPTIONS=
231           The mount options to use, if --options= is not used.
232
233       SYSTEMD_MOUNT_WHERE=
234           The file system path to place the mount point at, instead of the
235           automatically generated one.
236

EXAMPLE

238       Use a udev rule like the following to automatically mount all USB
239       storage plugged in:
240
241           ACTION=="add", SUBSYSTEMS=="usb", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", \
242                   RUN{program}+="/usr/bin/systemd-mount --no-block --automount=yes --collect $devnode"
243

SEE ALSO

245       systemd(1), mount(8), systemctl(1), systemd.unit(5), systemd.mount(5),
246       systemd.automount(5), systemd-run(1)
247
248
249
250systemd 241                                                   SYSTEMD-MOUNT(1)
Impressum