table of contents
- bookworm 252.30-1~deb12u2
- bookworm-backports 254.16-1~bpo12+1
- testing 256.7-2
- unstable 256.7-2
SYSTEMD-MOUNT(1) | systemd-mount | SYSTEMD-MOUNT(1) |
NAME¶
systemd-mount, systemd-umount - Establish and destroy transient mount or auto-mount points
SYNOPSIS¶
systemd-mount [OPTIONS...] WHAT [WHERE]
systemd-mount [OPTIONS...] --tmpfs [NAME] WHERE
systemd-mount [OPTIONS...] --list
systemd-mount [OPTIONS...] --umount WHAT|WHERE...
DESCRIPTION¶
systemd-mount may be used to create and start a transient .mount or .automount unit of the file system WHAT on the mount point WHERE.
In many ways, systemd-mount is similar to the lower-level mount(8) command, however instead of executing the mount operation directly and immediately, systemd-mount schedules it through 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.
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. "/dev/sdb1" or "/path/to/disk.img"). The block device or image file is then probed for a file system label and other metadata, and is mounted to a directory below /run/media/system/ 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 is created instead of a regular mount point (i.e. the --automount= option is implied, see below). If the option --tmpfs is specified, then the argument is interpreted as the path where the new temporary file system shall be mounted.
If two arguments are specified, the first indicates the mount source (the WHAT) and the second indicates the path to mount it on (the WHERE). In this mode no probing of the source is attempted, and a backing device node doesn't have to exist. However, if this mode is combined with --discover, device node probing for additional metadata is enabled, and – much like in the single-argument case discussed above – the specified device has to exist at the time of invocation of the command.
Use the --list command to show a terse table of all local, known block devices with file systems that may be mounted with this command.
systemd-umount can be used to unmount a mount or automount point. It is the same as systemd-mount --umount.
OPTIONS¶
The following options are understood:
--no-block
Added in version 232.
-l, --full
Added in version 245.
--no-pager
--no-legend
--no-ask-password
--quiet, -q
Added in version 232.
--discover
Added in version 232.
--type=, -t
Added in version 232.
--options=, -o
Added in version 232.
--owner=USER
Added in version 237.
--fsck=
Added in version 232.
--description=
Added in version 232.
--property=, -p
Added in version 232.
--automount=
If this switch is not specified it defaults to false. If not specified and --discover is used (or only a single argument passed, which implies --discover, see above), and the file system block device is detected to be removable, it is set to true, in order to increase the chance that the file system is in a fully clean state if the device is unplugged abruptly.
Added in version 232.
-A
Added in version 232.
--timeout-idle-sec=
Note that if --discover is used (or only a single argument passed, which implies --discover, see above), and the file system block device is detected to be removable, --timeout-idle-sec=1s is implied.
Added in version 232.
--automount-property=
Added in version 232.
--bind-device
Note that if --discover is used (or only a single argument passed, which implies --discover, see above), and the file system block device is detected to be removable, this option is implied.
Added in version 232.
--list
Added in version 232.
-u, --umount
Added in version 233.
-G, --collect
Added in version 236.
-T, --tmpfs
The file system is mounted with the top-level directory mode determined by the umask(2) setting of the caller, i.e. rwxrwxrwx masked by the umask of the caller. This matches what mkdir(1) does, but is different from the kernel default of "rwxrwxrwxt", i.e. a world-writable directory with the sticky bit set.
Added in version 255.
--user
--system
-H, --host=
-M, --machine=
-h, --help
--version
EXIT STATUS¶
On success, 0 is returned, a non-zero failure code otherwise.
THE UDEV DATABASE¶
If --discover is used, systemd-mount honors a couple of additional udev properties of block devices:
SYSTEMD_MOUNT_OPTIONS=
Added in version 232.
SYSTEMD_MOUNT_WHERE=
Added in version 232.
EXAMPLE¶
Use a udev rule like the following to automatically mount all USB storage plugged in:
ACTION=="add", SUBSYSTEMS=="usb", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", \
RUN{program}+="/usr/bin/systemd-mount --no-block --automount=yes --collect $devnode"
SEE ALSO¶
systemd(1), mount(8), systemctl(1), systemd.unit(5), systemd.mount(5), systemd.automount(5), systemd-run(1)
systemd 256.7 |