]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-mount.xml
Merge pull request #11827 from keszybz/pkgconfig-variables
[thirdparty/systemd.git] / man / systemd-mount.xml
CommitLineData
514094f9 1<?xml version='1.0'?>
450442cf
LP
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5<!--
572eb058 6 SPDX-License-Identifier: LGPL-2.1+
450442cf
LP
7-->
8
9<refentry id="systemd-mount"
10 xmlns:xi="http://www.w3.org/2001/XInclude">
11
12 <refentryinfo>
13 <title>systemd-mount</title>
14 <productname>systemd</productname>
450442cf
LP
15 </refentryinfo>
16
17 <refmeta>
18 <refentrytitle>systemd-mount</refentrytitle>
19 <manvolnum>1</manvolnum>
20 </refmeta>
21
22 <refnamediv>
23 <refname>systemd-mount</refname>
d20a328f
ZJS
24 <refname>systemd-umount</refname>
25 <refpurpose>Establish and destroy transient mount or auto-mount points</refpurpose>
450442cf
LP
26 </refnamediv>
27
28 <refsynopsisdiv>
29 <cmdsynopsis>
30 <command>systemd-mount</command>
31 <arg choice="opt" rep="repeat"><replaceable>OPTIONS</replaceable></arg>
32 <arg choice="plain"><replaceable>WHAT</replaceable></arg>
33 <arg choice="opt"><replaceable>WHERE</replaceable></arg>
34 </cmdsynopsis>
35 <cmdsynopsis>
36 <command>systemd-mount</command>
37 <arg choice="opt" rep="repeat"><replaceable>OPTIONS</replaceable></arg>
38 <arg choice="plain"><option>--list</option></arg>
39 </cmdsynopsis>
d20a328f 40 <cmdsynopsis>
9017f5d8 41 <command>systemd-mount</command>
d20a328f 42 <arg choice="opt" rep="repeat"><replaceable>OPTIONS</replaceable></arg>
9017f5d8
YW
43 <arg choice="plain"><option>--umount</option></arg>
44 <arg choice="plain" rep="repeat"><replaceable>WHAT|WHERE</replaceable></arg>
d20a328f 45 </cmdsynopsis>
450442cf
LP
46 </refsynopsisdiv>
47
48 <refsect1>
49 <title>Description</title>
50
51 <para><command>systemd-mount</command> may be used to create and start a transient <filename>.mount</filename> or
52 <filename>.automount</filename> unit of the file system <replaceable>WHAT</replaceable> on the mount point
53 <replaceable>WHERE</replaceable>.</para>
54
55 <para>In many ways, <command>systemd-mount</command> is similar to the lower-level
98e9d710 56 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> command, however instead
450442cf
LP
57 of executing the mount operation directly and immediately, <command>systemd-mount</command> schedules it through
58 the service manager job queue, so that it may pull in further dependencies (such as parent mounts, or a file system
59 checker to execute a priori), and may make use of the auto-mounting logic.</para>
60
61 <para>The command takes either one or two arguments. If only one argument is specified it should refer to a block
f0aac575
YW
62 device or regular file containing a file system (e.g. <literal>/dev/sdb1</literal> or
63 <literal>/path/to/disk.img</literal>). If it is a block device, which is then probed for a label and other
450442cf
LP
64 metadata, and is mounted to a directory whose name is generated from the label. In this mode the block device must
65 exist at the time of invocation of the command, so that it may be probed. If the device is found to be a removable
66 block device (e.g. a USB stick) an automount point instead of a regular mount point is created (i.e. the
67 <option>--automount=</option> option is implied, see below).</para>
68
69 <para>If two arguments are specified the first indicates the mount source (the <replaceable>WHAT</replaceable>) and
70 the second indicates the path to mount it on (the <replaceable>WHERE</replaceable>). In this mode no probing of the
71 source is attempted, and a backing device node doesn't have to exist yet. However, if this mode is combined with
72 <option>--discover</option>, device node probing for additional metadata is enabled, and – much like in the
73 single-argument case discussed above – the specified device has to exist at the time of invocation of the
74 command.</para>
75
76 <para>Use the <option>--list</option> command to show a terse table of all local, known block devices with file
77 systems that may be mounted with this command.</para>
d20a328f
ZJS
78
79 <para><command>systemd-umount</command> can be used to unmount a mount or automount point. It is the same
8cc7661d 80 as <command>systemd-mount</command> <option>--umount</option>.</para>
450442cf
LP
81 </refsect1>
82
83 <refsect1>
84 <title>Options</title>
85
86 <para>The following options are understood:</para>
87
88 <variablelist>
89
90 <varlistentry>
91 <term><option>--no-block</option></term>
92
93 <listitem>
94 <para>Do not synchronously wait for the requested operation to finish. If this is not specified, the job will
95 be verified, enqueued and <command>systemd-mount</command> will wait until the mount or automount unit's
96 start-up is completed. By passing this argument, it is only verified and enqueued.</para>
97 </listitem>
98 </varlistentry>
99
100 <xi:include href="standard-options.xml" xpointer="no-pager"/>
101 <xi:include href="standard-options.xml" xpointer="no-ask-password"/>
102
103 <varlistentry>
104 <term><option>--quiet</option></term>
105 <term><option>-q</option></term>
106
107 <listitem><para>Suppresses additional informational output while running.</para></listitem>
108 </varlistentry>
109
110 <varlistentry>
111 <term><option>--discover</option></term>
112
113 <listitem><para>Enable probing of the mount source. This switch is implied if a single argument is specified on
114 the command line. If passed, additional metadata is read from the device to enhance the unit to create. For
115 example, a descriptive string for the transient units is generated from the file system label and device
116 model. Moreover if a removable block device (e.g. USB stick) is detected an automount unit instead of a regular
3f9a0a52 117 mount unit is created, with a short idle timeout, in order to ensure the file-system is placed in a clean
450442cf
LP
118 state quickly after each access.</para></listitem>
119 </varlistentry>
120
121 <varlistentry>
122 <term><option>--type=</option></term>
123 <term><option>-t</option></term>
124
125 <listitem><para>Specifies the file system type to mount (e.g. <literal>vfat</literal>, <literal>ext4</literal>,
126 …). If omitted (or set to <literal>auto</literal>) the file system is determined automatically.</para></listitem>
127 </varlistentry>
128
129 <varlistentry>
130 <term><option>--options=</option></term>
131 <term><option>-o</option></term>
132
133 <listitem><para>Additional mount options for the mount point.</para></listitem>
134 </varlistentry>
135
e09fc884
ZJS
136 <varlistentry>
137 <term><option>--owner=<replaceable>USER</replaceable></option></term>
138
139 <listitem><para>Let the specified user <replaceable>USER</replaceable> own the mounted file system.
140 This is done by appending <option>uid=</option> and <option>gid=</option> options to the list
141 of mount options. Only certain file systems support this option.</para></listitem>
142 </varlistentry>
143
450442cf
LP
144 <varlistentry>
145 <term><option>--fsck=</option></term>
146
147 <listitem><para>Takes a boolean argument, defaults to on. Controls whether to run a file system check
148 immediately before the mount operation. In the automount case (see <option>--automount=</option> below) the
149 check will be run the moment the first access to the device is made, which might slightly delay the
150 access.</para></listitem>
151 </varlistentry>
152
153 <varlistentry>
154 <term><option>--description=</option></term>
155
156 <listitem><para>Provide a description for the mount or automount unit. See <varname>Description=</varname> in
157 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
158 </para></listitem>
159 </varlistentry>
160
161 <varlistentry>
162 <term><option>--property=</option></term>
163 <term><option>-p</option></term>
164
165 <listitem><para>Sets a unit property for the mount unit that is created. This takes an assignment in the same
166 format as <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
167 <command>set-property</command> command.</para>
168 </listitem>
169 </varlistentry>
170
171 <varlistentry>
172 <term><option>--automount=</option></term>
173
174 <listitem><para>Takes a boolean argument. Controls whether to create an automount point or a regular mount
175 point. If true an automount point is created that is backed by the actual file system at the time of first
176 access. If false a plain mount point is created that is backed by the actual file system immediately. Automount
177 points have the benefit that the file system stays unmounted and hence in clean state until it is first
178 accessed. In automount mode the <option>--timeout-idle-sec=</option> switch (see below) may be used to ensure
179 the mount point is unmounted automatically after the last access and an idle period passed.</para>
180
181 <para>If this switch is not specified it defaults to false. If not specified and <option>--discover</option> is
182 used (or only a single argument passed, which implies <option>--discover</option>, see above), and the file
183 system block device is detected to be removable, it is set to true, in order to increase the chance that the
184 file system is in a fully clean state if the device is unplugged abruptly.</para></listitem>
185 </varlistentry>
186
187 <varlistentry>
188 <term><option>-A</option></term>
189
190 <listitem><para>Equivalent to <option>--automount=yes</option>.</para></listitem>
191 </varlistentry>
192
193 <varlistentry>
194 <term><option>--timeout-idle-sec=</option></term>
195
196 <listitem><para>Takes a time value that controls the idle timeout in automount mode. If set to
197 <literal>infinity</literal> (the default) no automatic unmounts are done. Otherwise the file system backing the
198 automount point is detached after the last access and the idle timeout passed. See
199 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry> for details on
200 the time syntax supported. This option has no effect if only a regular mount is established, and automounting
201 is not used.</para>
202
203 <para>Note that if <option>--discover</option> is used (or only a single argument passed, which implies
204 <option>--discover</option>, see above), and the file system block device is detected to be removable,
205 <option>--timeout-idle-sec=1s</option> is implied.</para></listitem>
206 </varlistentry>
207
208 <varlistentry>
209 <term><option>--automount-property=</option></term>
210
211 <listitem><para>Similar to <option>--property=</option>, but applies additional properties to the automount
212 unit created, instead of the mount unit.</para></listitem>
213 </varlistentry>
214
215 <varlistentry>
216 <term><option>--bind-device=</option></term>
217
218 <listitem><para>Takes a boolean argument, defaults to off. This option only has an effect in automount mode,
219 and controls whether the automount unit shall be bound to the backing device's lifetime. If enabled, the
220 automount point will be removed automatically when the backing device vanishes. If disabled the automount point
221 stays around, and subsequent accesses will block until backing device is replugged. This option has no effect
222 in case of non-device mounts, such as network or virtual file system mounts.</para>
223
224 <para>Note that if <option>--discover</option> is used (or only a single argument passed, which implies
225 <option>--discover</option>, see above), and the file system block device is detected to be removable, this
226 option is implied.</para></listitem>
227 </varlistentry>
228
229 <varlistentry>
230 <term><option>--list</option></term>
231
232 <listitem><para>Instead of establishing a mount or automount point, print a terse list of block devices
233 containing file systems that may be mounted with <literal>systemd-mount</literal>, along with useful metadata
234 such as labels, etc.</para></listitem>
235 </varlistentry>
236
d20a328f
ZJS
237 <varlistentry>
238 <term><option>-u</option></term>
cec2a20d 239 <term><option>--umount</option></term>
d20a328f
ZJS
240
241 <listitem><para>Stop the mount and automount units corresponding to the specified mount points
9017f5d8
YW
242 <replaceable>WHERE</replaceable> or the devices <replaceable>WHAT</replaceable>.
243 <command>systemd-mount</command> with this option or <command>systemd-umount</command> can take multiple arguments
6f6165bf
YW
244 which can be mount points, devices, <filename>/etc/fstab</filename> style node names, or backing files
245 corresponding to loop devices, like
246 <command>systemd-mount --umount /path/to/umount /dev/sda1 UUID=xxxxxx-xxxx LABEL=xxxxx /path/to/disk.img</command>.
3747daa2
YW
247 Note that when <option>-H</option> or <option>-M</option> is specified, only absolute paths to mount points are
248 supported.</para></listitem>
d20a328f
ZJS
249 </varlistentry>
250
dc336483
YW
251 <varlistentry>
252 <term><option>-G</option></term>
253 <term><option>--collect</option></term>
254
255 <listitem><para>Unload the transient unit after it completed, even if it failed. Normally, without this option,
256 all mount units that mount and failed are kept in memory until the user explicitly resets their failure state with
257 <command>systemctl reset-failed</command> or an equivalent command. On the other hand, units that stopped
258 successfully are unloaded immediately. If this option is turned on the "garbage collection" of units is more
1b2ad5d9 259 aggressive, and unloads units regardless if they exited successfully or failed. This option is a shortcut for
dc336483
YW
260 <command>--property=CollectMode=inactive-or-failed</command>, see the explanation for
261 <varname>CollectMode=</varname> in
262 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for further
263 information.</para></listitem>
264 </varlistentry>
265
450442cf
LP
266 <xi:include href="user-system-options.xml" xpointer="user" />
267 <xi:include href="user-system-options.xml" xpointer="system" />
268 <xi:include href="user-system-options.xml" xpointer="host" />
269 <xi:include href="user-system-options.xml" xpointer="machine" />
270
271 <xi:include href="standard-options.xml" xpointer="help" />
272 <xi:include href="standard-options.xml" xpointer="version" />
273 </variablelist>
274
275 </refsect1>
276
277 <refsect1>
278 <title>Exit status</title>
279
280 <para>On success, 0 is returned, a non-zero failure
281 code otherwise.</para>
282 </refsect1>
283
284 <refsect1>
285 <title>The udev Database</title>
286
2dd67817 287 <para>If <option>--discover</option> is used, <command>systemd-mount</command> honors a couple of additional udev
450442cf
LP
288 properties of block devices:</para>
289
290 <variablelist class='udev-directives'>
291 <varlistentry>
292 <term><varname>SYSTEMD_MOUNT_OPTIONS=</varname></term>
293
294 <listitem><para>The mount options to use, if <option>--options=</option> is not used.</para></listitem>
295 </varlistentry>
296
297 <varlistentry>
298 <term><varname>SYSTEMD_MOUNT_WHERE=</varname></term>
299
300 <listitem><para>The file system path to place the mount point at, instead of the automatically generated
301 one.</para></listitem>
302 </varlistentry>
303 </variablelist>
304 </refsect1>
305
306 <refsect1>
307 <title>See Also</title>
308 <para>
309 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
98e9d710 310 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
450442cf
LP
311 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
312 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
313 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
314 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
315 <citerefentry><refentrytitle>systemd-run</refentrytitle><manvolnum>1</manvolnum></citerefentry>
316 </para>
317 </refsect1>
318
319</refentry>