LinuxCommandLibrary

systemctl-list-automounts

List active automount units

TLDR

List automount units currently in memory

$ systemctl list-automounts
copy

List all automount units, including inactive ones
$ systemctl list-automounts [[-a|--all]]
copy

Filter automount units by state
$ systemctl list-automounts --state [active|inactive|failed|...]
copy

Filter automount units by name pattern
$ systemctl list-automounts [pattern1 pattern2 ...]
copy

SYNOPSIS

systemctl [OPTIONS...] list-automounts [PATTERN...]

PARAMETERS

--all, -a
    Show all loaded units, regardless of their active state. By default, only active and 'failed' units are shown.

--legend, -l
    Show the legend at the bottom of the output, explaining the column headers.

--no-legend
    Do not show the legend at the bottom of the output.

--no-pager
    Do not pipe output into a pager. Useful for scripting or capturing full output.

--full, -f
    Do not ellipsize unit names or truncate them in any other way in the output.

--output=FORMAT
    Change the output format for units listed. Possible formats include json, json-pretty, yaml, properties, value, and table (default).

PATTERN...
    One or more glob patterns to filter the units by name. Only units matching these patterns will be displayed.

DESCRIPTION

The systemctl list-automounts command displays a comprehensive list of all active automount units currently managed by systemd. Automount units are special systemd units ('.automount' files) designed to automatically mount filesystems only when they are first accessed. This 'on-demand' mounting strategy helps reduce boot times and system resource consumption by not mounting all filesystems upfront.

The output typically includes the unit name, its load state, active state, sub-state, and a descriptive message. This command is crucial for administrators to inspect which filesystems are configured for lazy mounting and their current status, aiding in troubleshooting or verifying system configuration related to network shares, removable media, or infrequently accessed local partitions.

CAVEATS

This command only lists automount units managed by systemd. Filesystems mounted manually or via other mechanisms (e.g., /etc/fstab entries without a corresponding .automount unit) will not appear here unless systemd has explicitly created and manages an automount point for them.

The 'active' state of an automount unit usually means it's ready to trigger a mount, not that the filesystem is currently mounted. The actual mount unit will only become active when the automount point is accessed.

WHAT IS AN AUTOMOUNT UNIT?

An automount unit (.automount) defines an automount point in the filesystem hierarchy. Instead of mounting a filesystem at boot, the automount unit sets up a trigger. When a process attempts to access the directory specified by the automount point, systemd intercepts this access and then dynamically mounts the associated filesystem (.mount unit). This significantly improves boot times and reduces resource usage for infrequently accessed resources like network shares (NFS, Samba) or removable media.

RELATIONSHIP WITH .MOUNT UNITS

Every .automount unit typically has a corresponding .mount unit. The .automount unit is responsible for when the mount happens (on-demand), while the .mount unit defines how the filesystem is mounted (source, target, type, options). list-automounts shows the automount triggers, while list-mounts shows the currently active mounts.

HISTORY

The list-automounts command is part of the systemctl utility, which is the primary control interface for systemd. systemd was first introduced in Fedora 15 in 2011 and has progressively replaced the traditional SysVinit and Upstart systems across most major Linux distributions. As systemd took over the management of system services, mounts, sockets, and other resources, commands like list-automounts became essential for managing and inspecting the new declarative unit-based system. It provides a modern and unified way to interact with systemd's automount capabilities, which were previously managed by tools like autofs.

SEE ALSO

systemctl(1), systemctl list-units(1), systemctl list-mounts(1), systemd.automount(5), mount(8), fstab(5)

Copied to clipboard