SYSTEMD-MOUNT(1)
๐ systemd-mount(1) ๐
okay bestie, grab a snack because we're talking about systemd-mount โ and yeah, that's SYSTEMD-MOUNT(1) if you're fancy, from the systemd-mount corner of the manual ๐
โจ NAME โจ
systemd-mount, systemd-umount โ establish and destroy transient mount or auto-mount points. that's it, that's the whole vibe: you make mounts, you break mounts, you move on with your day ๐ฆ
๐ธ SYNOPSIS ๐ธ
systemd-mount [OPTIONS...] WHAT [WHERE]
systemd-mount [OPTIONS...] --tmpfs [NAME] WHERE
systemd-mount [OPTIONS...] --list
systemd-mount [OPTIONS...] --umount WHAT|WHERE...
๐ DESCRIPTION ๐
so what does it actually do. systemd-mount can create and start a transient .mount or .automount unit for the file system WHAT on the mount point WHERE. transient meaning it's not some permanent config file you wrote at 3am โ it just exists for now โจ
in a lot of ways, systemd-mount is giving the same energy as the lower-level mount(8) command. but here's the plot twist, and it's kind of the whole point: instead of just doing the mount operation directly and immediately like mount(8) does, systemd-mount schedules it through the service manager job queue. why do we care? because that means it can pull in further dependencies for you โ think parent mounts, or a file system checker that has to run a priori (before the thing, okay) โ and it can make use of the auto-mounting logic. it's giving delegation, it's giving teamwork, it's giving the service manager doing the heavy lifting ๐ฅ
the way it takes arguments
the command takes either one or two arguments, and which one you're in changes everything, so pay attention bestie ๐
if only one argument is specified โ that argument should refer to a block device or a regular file containing a file system. like "/dev/sdb1" or "/path/to/disk.img", for example. the block device or image file then gets probed for a file system label and other metadata, and it's mounted to a directory below /run/media/system/ โ and the name of that directory is generated from the file system label. cute, right? ๐
โ ๏ธ but fr fr, 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. no device, no probe, no mount. periodt.
and if the device turns out to be a removable block device (think: a USB stick, you know the one, the one in your bag with the mystery files on it ๐), then an automount point is created instead of a regular mount point. that means the --automount= option is implied โ we'll get to that below, don't worry, we don't gatekeep.
oh and also: if the --tmpfs option is specified, then the argument gets interpreted as the path where the new temporary file system shall be mounted. different meaning, same slot. iconic behaviour honestly.
if two arguments are specified โ the first one is the mount source (the WHAT) and the second one is the path to mount it on (the WHERE). and in this mode? no probing of the source is attempted at all, and a backing device node does not have to exist. freedom ๐
but lowkey watch out: if you combine this mode with--discover, then device node probing for additional metadata gets enabled โ and, much like in the single-argument case we just talked about, the specified device has to exist at the time of invocation of the command. so the "device doesn't need to exist" perk gets cancelled the moment--discoverwalks in ๐ญ
listing things
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. terse table, maximum clarity, zero fluff โจ
and the destruction part
systemd-umount can be used to unmount a mount or automount point. and plot twist: it's literally the same as systemd-mount --umount. that's it. that's the whole thing. she's a one-liner bestie ๐ซถ
โจ OPTIONS โจ
okay bestie, here's the whole entire menu of flags. every single one, no skipping, no cap. grab a snack ๐
--no-blockโ Don't sit there waiting for the operation to actually finish, like, synchronously. Without this, the job gets verified, enqueued, and thensystemd-mountjust vibes waiting for the mount or automount unit's start-up to complete. With this flag? It only gets verified and enqueued, and we move on with our lives. ๐
Added in version 232.
-l,--fullโ Don't ellipsize the output when--listis specified. No "..." truncation, we show the whole thing. ๐
Added in version 245.
--no-pagerโ Don't pipe output into a pager. Just print it straight to your terminal, no scrolling situation.--no-legendโ Don't print the legend, aka the column headers and that little footer with hints. We're skipping the tutorial level.--no-ask-passwordโ Do NOT query the user for authentication for privileged operations. No password prompt, periodt.--json=MODEโ Shows output formatted as JSON. Expects exactly one of"short"(the shortest possible output, no redundant whitespace or line breaks, we're being efficient ๐),"pretty"(same thing but pretty, with indentation and line breaks, main character energy โจ) or"off"(turns JSON output off โ this is the default).--quiet,-qโ Suppresses extra informational output while running. Shhh. ๐คซ
Added in version 232.
--discoverโ Turns on probing of the mount source. This switch is implied if you only pass a single argument on the command line. If it's passed, we read additional metadata from the device to enhance the unit we're about to create โ like, a descriptive string for the transient units gets generated from the file system label and device model. And moreover (yes, moreover), if a removable block device is detected (think USB stick ๐ฆ) an automount unit gets created instead of a regular mount unit, with a short idle timeout, so the file-system gets placed into a clean state quickly after each access.
Added in version 232.
--type=,-tโ Specifies the file system type to mount (e.g."vfat"or"ext4"). If it's omitted or set to"auto", the file system type is determined automatically. She figures it out herself. ๐โโ๏ธ
Added in version 232.
--options=,-oโ Additional mount options for the mount point. Extra toppings, if you will.
Added in version 232.
--owner=USERโ Lets the specified user USER own the mounted file system. How? By appendinguid=andgid=options to the list of mount options. Only certain file systems support this, so don't be shocked if some of them say no.
Added in version 237.
--fsck=โ Takes a boolean argument, and defaults to on. Controls whether to run a file system check immediately before the mount operation. In the automount case (peep--automount=below) the check runs the moment the first access to the device is made, which might slightly delay that access. Sorry, bestie. ๐ซถ
Added in version 232.
--description=โ Provide a description for the mount or automount unit. SeeDescription=insystemd.unit(5).
Added in version 232.
--property=,-pโ Sets a unit property for the mount unit that gets created. Takes an assignment in the exact same format assystemctl(1)'sset-propertycommand.
Added in version 232.
--automount=โ Takes a boolean argument. Controls whether we create an automount point or a regular mount point. If true, an automount point is created that's backed by the actual file system at the time of first access. If false, a plain mount point is created that's backed by the actual file system immediately. Automount points have the benefit that the file system stays unmounted and therefore in a clean state until it's first accessed. In automount mode the--timeout-idle-sec=switch (see below ๐) may be used to make sure the mount point is unmounted automatically after the last access and an idle period passed.
If this switch isn't specified, it defaults to false. But โ plot twist โ if it's not specified and --discover is used (or only a single argument is passed, which implies --discover, see above), and the file system block device is detected to be removable, it's set to true, to increase the chance that the file system is in a fully clean state if the device gets unplugged abruptly. ๐ญ
Added in version 232.
-Aโ Equivalent to--automount=yes. Same thing, shorter to type. slay.
Added in version 232.
--timeout-idle-sec=โ Takes a time value that controls the idle timeout in automount mode. If set to"infinity"(which is the default) no automatic unmounts are done. Otherwise, the file system backing the automount point is detached after the last access and the idle timeout passed. Seesystemd.time(7)for the details on the time syntax supported. This option has no effect if only a regular mount is established and automounting isn't used.
Heads up: if --discover is used (or only a single argument is 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=โ Similar to--property=, but it applies additional properties to the automount unit created, instead of the mount unit.
Added in version 232.
--bind-deviceโ Controls whether the generated mount/automount unit shall be bound to the backing device's lifetime. This setting is especially useful in automount mode. If set, the units get stopped automatically when the backing device vanishes. By default, the automount unit stays around, and subsequent accesses will block until the backing device is replugged. This option has no effect in case of non-device mounts, such as network or virtual file system mounts.
If --discover is used (or only a single argument is passed, which implies --discover, see above), and the file system block device is detected to be removable, this option is implied.
Note that mount units by default gain a Requires= dependency on the backing device. This behavior can be controlled via the x-systemd.device-bound= mount option โ see systemd.mount(5) for details. In particular, x-systemd.device-bound=no takes precedence over this option, which suppresses device dependencies both in the generated mount units and what's implied by the service manager.
Added in version 232.
--listโ Instead of establishing a mount or automount point, print a terse list of block devices containing file systems that may be mounted with"systemd-mount", along with useful metadata such as labels, etc. A lil shopping list, if you will. ๐
Added in version 232.
-u,--umountโ Stop the mount and automount units corresponding to the specified mount points WHERE or the devices WHAT.systemd-mountwith this option โ orsystemd-umountโ can take multiple arguments, which can be mount points, devices,/etc/fstabstyle node names, or backing files corresponding to loop devices, like this:
systemd-mount --umount /path/to/umount /dev/sda1 UUID=xxxxxx-xxxx LABEL=xxxxx /path/to/disk.img
Note that when -H or -M is specified, only absolute paths to mount points are supported.
Added in version 233.
-G,--collectโ Unload the transient unit after it completed, even if it failed. Normally (i.e. without this option) all mount units that mount and failed are kept in memory until the user explicitly resets their failure state withsystemctl reset-failedor 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 gets more aggressive, and unloads units regardless of whether they exited successfully or failed. This option is a shortcut for--property=CollectMode=inactive-or-failedโ see the explanation forCollectMode=insystemd.unit(5)for further info.
Added in version 236.
-T,--tmpfsโ Create and mount a brand newtmpfsfile system on WHERE, with an optional NAME that defaults to"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 it's different from the kernel default of "rwxrwxrwxt" โ i.e. a world-writable directory with the sticky bit set.
Added in version 255.
--canonicalize=โ Controls whether the specified path shall be canonicalized on the client side before requesting the operation or not. Takes a boolean parameter, and defaults to true. Note that for non-local operation (i.e. when--machine=or----host=are used) canonicalization is implicitly turned off.
Canonicalization of path entails resolving symlinks, ".." path elements, and LABEL=/UUID= style device node expansion. If canonicalization is disabled and the path contains a symlink element, "..", or a LABEL=/UUID=/... expansion, the operation will fail. โ ๏ธ
Added in version 258.
--userโ Talk to the service manager of the calling user, rather than the service manager of the system.--systemโ Talk to the service manager of the system. This is the implied default.-H,--host=โ Execute the operation remotely. Specify a hostname, or a username and hostname separated by"@", to connect to. The hostname may optionally be suffixed by a port ssh is listening on, separated by":", and then a container name, separated by"/", which connects directly to a specific container on the specified host. This uses SSH to talk to the remote machine manager instance. Container names may be enumerated withmachinectl -H HOST. Put IPv6 addresses in brackets. ๐-M,--machine=โ Execute operation on a local container. Specify a container name to connect to, optionally prefixed by a user name to connect as and a separating"@"character. If the special string".host"is used in place of the container name, a connection to the local system is made (which is useful to connect to a specific user's user bus:"--user --machine=lennart@.host"). If the"@"syntax isn't used, the connection is made as root user. If the"@"syntax is used, either the left hand side or the right hand side may be omitted (but not both), in which case the local user name and".host"are implied.-h,--helpโ Print a short help text and exit. classic.--versionโ Print a short version string and exit.
๐ EXIT STATUS ๐
On success, 0 is returned. A non-zero failure code otherwise. That's it, that's the whole thing โ if it worked you get a cute lil zero, if it didn't, you get a sad number. ๐ญ
๐ฆ THE UDEV DATABASE ๐ฆ
okay so this is the fun part. when you're out here using --discover, systemd-mount is not just vibing on its own โ it also peeks at a couple of extra udev properties on block devices. bestie, it's literally reading the room. ๐
SYSTEMD_MOUNT_OPTIONS=โ the mount options to use, but ONLY if--options=isn't already being used. so like,--options=wins the argument, periodt. ๐
Added in version 232.
SYSTEMD_MOUNT_WHERE=โ the file system path where the mount point should go, instead of that automatically generated one. you get to pick the spot. main character energy, honestly. โจ
Added in version 232.
๐ EXAMPLE ๐
want every single USB storage thing that gets plugged in to just auto-mount itself?? no cap, use a udev rule like this one:
ACTION=="add", SUBSYSTEMS=="usb", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", \
RUN{program}+="/usr/bin/systemd-mount --no-block --automount=yes --collect $devnode"
likeโฆ the way that it just does that for you. iconic. ๐
โจ SEE ALSO โจ
go read these next, they're all connected iykyk ๐ซถ
systemd(1)mount(8)systemctl(1)systemd.unit(5)systemd.mount(5)systemd.automount(5)systemd-run(1)
and that's the whole page, bestie!! ๐ we did it. this little masterpiece is brought to you by systemd 262.1 โ she's serving SYSTEMD-MOUNT(1) and she ate, fr fr. go mount something cute. ๐ธ๐
๐ฆ where this page comes from
- arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms