Skip to content
Tutorials Center
My learning

Topics

Linux Command Reference ยท Disks and Filesystems

Linux findmnt command

Reference for the Linux findmnt command: show mounted filesystems as a tree, find the mount of a path, select columns with -o, filter by type and verify fstab.

findmnt lists the filesystems that are mounted right now, or the ones configured in /etc/fstab, and shows how they nest. Without arguments it prints a tree, so you can see at a glance that /boot sits inside / and a bind mount sits inside another directory. It reads the kernel's mount table, so it always reflects reality.

Compared with the plain table printed by mount or the free-space view of df, findmnt is made for both people and scripts: you can choose columns, filter by type or options, print without headers, and ask a precise question such as "which filesystem holds this path?".

Terminal
findmnt
findmnt -T /var/log

Try it

Bash Which filesystem holds a path?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Bash Filter by type and choose columns

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Syntax

Terminal
findmnt [OPTIONS] [DEVICE|MOUNTPOINT]
findmnt [OPTIONS] -T PATH
findmnt [OPTIONS] -S SOURCE | -M MOUNTPOINT | -t TYPE
Option Description
-T PATH, --target PATH Find the mount that contains PATH (the path itself need not be a mount point).
-M DIR, --mountpoint DIR Match only when DIR is exactly a mount point.
-S SRC, --source SRC Match the mounted device (/dev/sda1, UUID=..., LABEL=...).
-t TYPE, --types TYPE Only these filesystem types (comma separated; prefix no to exclude, as in -t noproc,nosysfs).
-O OPTS Only filesystems that have these options (-O ro).
-o COLS, --output COLS Columns to print: SOURCE, TARGET, FSTYPE, OPTIONS, SIZE, USED, AVAIL, USE%, UUID, LABEL and more.
-l, --list List form instead of a tree.
-r, --raw Raw output without tree drawing characters and with escaped spaces; good for parsing.
-n, --noheadings Do not print the header line.
-J, --json JSON output.
-s, --fstab Read /etc/fstab instead of the live table.
-D, --df Show a df-like report with sizes.
--verify Check /etc/fstab (or another table) for mistakes and print warnings.
-R, --submounts Include submounts of a given directory.

Returns: 0 when something matched, 1 when the filter matched nothing (so it works in if), 2 for errors in the command line or the table.

Usage notes

  • -T versus -M. -T /var/log/app answers "where does this live?" and succeeds for any path. -M /var/log/app succeeds only when that exact directory is a mount point. Use -M for "is it mounted?" checks.
  • Use -n -o COL for scripts. findmnt -n -o SOURCE -T /data prints just the device and nothing else, which is far more stable than parsing mount output.
  • --verify is a safety net for fstab. Run findmnt --verify after editing /etc/fstab and before rebooting; it checks that mount points exist, types are known and fields are sane. See fstab and mount options.
  • Bind mounts and subvolumes show the source as /dev/sda1[/subdir], with the part in brackets being the path inside the filesystem.
  • Pseudo-filesystems clutter the tree (proc, sysfs, cgroup2, tmpfs). Hide them with -t noproc,nosysfs,nocgroup2,notmpfs or show only real storage with -D -t ext4,xfs,btrfs.
  • Containers. Inside a container the table shows the container's own view, usually an overlay root with many bind mounts.
  • Epoch of the data. The live table comes from /proc/self/mountinfo, so it is exact even for mounts in your mount namespace that /etc/mtab would miss.
  • Spaces in paths appear as \040 in raw output; use -r only when you decode that, or prefer -J.