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