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 --discover walks 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 then systemd-mount just 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 --list is 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 appending uid= and gid= 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. See Description= in systemd.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 as systemctl(1)'s set-property command.

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. See systemd.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-mount with this option โ€” or systemd-umount โ€” can take multiple arguments, which can be mount points, devices, /etc/fstab style 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 with systemctl reset-failed 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 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 for CollectMode= in systemd.unit(5) for further info.

Added in version 236.

  • -T, --tmpfs โ€” Create and mount a brand new tmpfs file 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 with machinectl -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 ๐Ÿซถ


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