]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - man/systemd-mount.xml
travis: use UBSan checks from OSS-Fuzz
[thirdparty/systemd.git] / man / systemd-mount.xml
index 68654f43a67c1324d3092402ea0363aa4491232c..4a7c33f5584244261e9de09cc7f9fe25ab09849e 100644 (file)
@@ -1,25 +1,7 @@
-<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<!--
-  This file is part of systemd.
-
-  Copyright 2016 Lennart Poettering
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
--->
+<?xml version='1.0'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!-- SPDX-License-Identifier: LGPL-2.1+ -->
 
 <refentry id="systemd-mount"
           xmlns:xi="http://www.w3.org/2001/XInclude">
@@ -27,15 +9,6 @@
   <refentryinfo>
     <title>systemd-mount</title>
     <productname>systemd</productname>
-
-    <authorgroup>
-      <author>
-        <contrib>Developer</contrib>
-        <firstname>Lennart</firstname>
-        <surname>Poettering</surname>
-        <email>lennart@poettering.net</email>
-      </author>
-    </authorgroup>
   </refentryinfo>
 
   <refmeta>
     the service manager job queue, so that it may pull in further dependencies (such as parent mounts, or a file system
     checker to execute a priori), and may make use of the auto-mounting logic.</para>
 
-    <para>The command takes either one or two arguments. If only one argument is specified it should refer to a block
-    device containing a file system (e.g. <literal>/dev/sdb1</literal>), which is then probed for a label and other
-    metadata, and is mounted to a directory whose name is generated from the label. In this mode the block device must
-    exist at the time of invocation of the command, so that it may be probed. If the device is found to be a removable
-    block device (e.g. a USB stick) an automount point instead of a regular mount point is created (i.e. the
-    <option>--automount=</option> option is implied, see below).</para>
+    <para>The command takes either one or two arguments. If only one argument is specified it should refer to
+    a block device or regular file containing a file system (e.g. <literal>/dev/sdb1</literal> or
+    <literal>/path/to/disk.img</literal>). The block device or image file is then probed for a file system
+    label and other metadata, and is mounted to a directory below <filename>/run/media/system/</filename>
+    whose name is generated from the file system label. In this mode the block device or image file must
+    exist at the time of invocation of the command, so that it may be probed. If the device is found to be a
+    removable block device (e.g. a USB stick) an automount point instead of a regular mount point is created
+    (i.e. the <option>--automount=</option> option is implied, see below).</para>
 
     <para>If two arguments are specified the first indicates the mount source (the <replaceable>WHAT</replaceable>) and
     the second indicates the path to mount it on (the <replaceable>WHERE</replaceable>). In this mode no probing of the
     systems that may be mounted with this command.</para>
 
     <para><command>systemd-umount</command> can be used to unmount a mount or automount point. It is the same
-    as <command>systemd-mount</command> <option>--unmount</option>.</para>
+    as <command>systemd-mount</command> <option>--umount</option>.</para>
   </refsect1>
 
   <refsect1>
         the command line. If passed, additional metadata is read from the device to enhance the unit to create. For
         example, a descriptive string for the transient units is generated from the file system label and device
         model. Moreover if a removable block device (e.g. USB stick) is detected an automount unit instead of a regular
-        mount unit is created, with a short idle time-out, in order to ensure the file-system is placed in a clean
+        mount unit is created, with a short idle timeout, in order to ensure the file-system is placed in a clean
         state quickly after each access.</para></listitem>
       </varlistentry>
 
         <listitem><para>Additional mount options for the mount point.</para></listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><option>--owner=<replaceable>USER</replaceable></option></term>
+
+        <listitem><para>Let the specified user <replaceable>USER</replaceable> own the mounted file system.
+        This is done by appending <option>uid=</option> and <option>gid=</option> options to the list
+        of mount options. Only certain file systems support this option.</para></listitem>
+      </varlistentry>
+
       <varlistentry>
         <term><option>--fsck=</option></term>
 
       </varlistentry>
 
       <varlistentry>
-        <term><option>--bind-device=</option></term>
+        <term><option>--bind-device</option></term>
 
-        <listitem><para>Takes a boolean argument, defaults to off. This option only has an effect in automount mode,
-        and controls whether the automount unit shall be bound to the backing device's lifetime. If enabled, the
-        automount point will be removed automatically when the backing device vanishes. If disabled the automount point
+        <listitem><para>This option only has an effect in automount mode,
+        and controls whether the automount unit shall be bound to the backing device's lifetime. If set, the
+        automount point will be removed automatically when the backing device vanishes. By default the automount point
         stays around, and subsequent accesses will block until backing device is replugged. This option has no effect
         in case of non-device mounts, such as network or virtual file system mounts.</para>
 
         <listitem><para>Stop the mount and automount units corresponding to the specified mount points
         <replaceable>WHERE</replaceable> or the devices <replaceable>WHAT</replaceable>.
         <command>systemd-mount</command> with this option or <command>systemd-umount</command> can take multiple arguments
-        which can be path, device, or <filename>/etc/fstab</filename> style node name, like
-        <command>systemd-mount --umount /path/to/umount /dev/sda1 UUID=xxxxxx-xxxx LABEL=xxxxx</command>.
-      </para>
-        </listitem>
+        which can be mount points, devices, <filename>/etc/fstab</filename> style node names, or backing files
+        corresponding to loop devices, like
+        <command>systemd-mount --umount /path/to/umount /dev/sda1 UUID=xxxxxx-xxxx LABEL=xxxxx /path/to/disk.img</command>.
+        Note that when <option>-H</option> or <option>-M</option> is specified, only absolute paths to mount points are
+        supported.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-G</option></term>
+        <term><option>--collect</option></term>
+
+        <listitem><para>Unload the transient unit after it completed, even if it failed. Normally, without this option,
+        all mount units that mount and failed are kept in memory until the user explicitly resets their failure state with
+        <command>systemctl reset-failed</command> or an equivalent command. On the other hand, units that stopped
+        successfully are unloaded immediately. If this option is turned on the "garbage collection" of units is more
+        aggressive, and unloads units regardless if they exited successfully or failed. This option is a shortcut for
+        <command>--property=CollectMode=inactive-or-failed</command>, see the explanation for
+        <varname>CollectMode=</varname> in
+        <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for further
+        information.</para></listitem>
       </varlistentry>
 
       <xi:include href="user-system-options.xml" xpointer="user" />
     </variablelist>
   </refsect1>
 
+  <refsect1>
+    <title>Example</title>
+
+    <para>Use a udev rule like the following to automatically mount all USB storage plugged in:</para>
+
+    <programlisting>ACTION=="add", SUBSYSTEMS=="usb", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", \
+        RUN{program}+="/usr/bin/systemd-mount --no-block --automount=yes --collect $devnode"</programlisting>
+  </refsect1>
+
   <refsect1>
     <title>See Also</title>
     <para>