opscape

Disks and filesystems

findmnt

Show mounted filesystems as a tree, or look up which filesystem a path is on and how it is mounted.

findmnt [OPTION...] [SOURCE|TARGET]

10 of 10 examples run in Debian 13.7 on 2026-10-31 · util-linux 2.41.5-0+deb13u1 · manual: findmnt(8)

findmnt is the modern, readable replacement for running mount with no arguments or reading /proc/self/mountinfo. Without arguments it draws every mount as a tree. With a mount point or device it shows just that entry, and with -T PATH it finds the filesystem that contains any file or directory.

Its options make it script-friendly: -o chooses columns, -n drops the header, -J prints JSON, -t filters by type, and the exit status says whether anything matched. It can also read and check /etc/fstab (-s, --verify), which is worth doing after every edit: a broken fstab can stop a machine from booting.

The examples here run in a container. Its root filesystem is an overlay, and the full mount tree is left out because it describes the build server rather than anything useful; the examples look at specific mounts instead.

Examples

Which filesystem is this directory on

findmnt -T . -o TARGET,SOURCE,FSTYPE
explain
output
TARGET SOURCE  FSTYPE
/      overlay overlay

-T (--target) walks up from the path to the mount point that contains it. Here that is /, an overlay filesystem, the usual root of a container. On a laptop you would see something like /home on /dev/nvme0n1p3.

Details of one mount point

findmnt /proc
explain
output
TARGET SOURCE FSTYPE OPTIONS
/proc  proc   proc   rw,nosuid,nodev,noexec,relatime

Given a mount point, findmnt prints its source, type and mount options. nosuid, nodev and noexec are typical hardening options for virtual filesystems.

All mounts of certain types

findmnt -t devpts,mqueue
explain
output
TARGET      SOURCE FSTYPE OPTIONS
/dev/pts    devpts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666
/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime

-t takes a comma-separated list of filesystem types. findmnt -t ext4,xfs,btrfs is the usual way to see only the real disk filesystems on a machine.

Print just the mount options

findmnt -n -o OPTIONS /dev/shm
explain
output
rw,nosuid,nodev,noexec,relatime,size=65536k,inode64

-n drops the header and -o OPTIONS keeps one column, so a script can test for, say, noexec. Here /dev/shm is a 64 MiB tmpfs, the container's default.

Find mounts with a given option

findmnt -O ro -t sysfs,proc -o TARGET,FSTYPE,OPTIONS
explain
output
TARGET              FSTYPE OPTIONS
/proc/bus           proc   ro,nosuid,nodev,noexec,relatime
/proc/sys           proc   ro,nosuid,nodev,noexec,relatime
/proc/irq           proc   ro,nosuid,nodev,noexec,relatime
/proc/sysrq-trigger proc   ro,nosuid,nodev,noexec,relatime
/proc/fs            proc   ro,nosuid,nodev,noexec,relatime
/sys                sysfs  ro,nosuid,nodev,noexec,relatime

-O ro keeps only read-only mounts. The container runtime mounts /sys and parts of /proc read-only so that processes inside cannot change kernel settings.

Usage figures like df

findmnt -D /dev/shm
explain
output
SOURCE FSTYPE SIZE USED AVAIL USE% TARGET
shm    tmpfs   64M    0   64M   0% /dev/shm

-D (--df) switches to df-style columns, with the mount point last.

JSON for scripts

findmnt -J /dev/pts
explain
output
{
   "filesystems": [
      {
         "target": "/dev/pts",
         "source": "devpts",
         "fstype": "devpts",
         "options": "rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666"
      }
   ]
}

-J prints JSON; every mount is an object under filesystems.

Test whether something is mounted

if findmnt -rn /mnt/backup > /dev/null; then
  echo "backup disk mounted"
else
  echo "backup disk NOT mounted, skipping"
fi
output
backup disk NOT mounted, skipping

The exit status is 0 when a match is found and 1 otherwise, which makes findmnt a reliable guard before writing a backup into what might be an empty directory on the root disk.

Read an fstab file

fstab
# <source>                                 <target>   <type> <options>          <dump> <pass>
UUID=0a3407de-014b-458b-b5c1-848e92a327a3  /          ext4   errors=remount-ro  0      1
UUID=6E2C-8F1A                             /boot/efi  vfat   umask=0077         0      1
/dev/sdb1                                  /data      ext4   defaults,noatime   0      2
tmpfs                                      /tmp       tmpfs  size=2G,mode=1777  0      0
server:/export/home                        /mnt/home  nfs    defaults,_netdev   0      0
findmnt -F fstab
explain
output
TARGET    SOURCE                                    FSTYPE OPTIONS
/         UUID=0a3407de-014b-458b-b5c1-848e92a327a3 ext4   errors=remount-ro
/boot/efi UUID=6E2C-8F1A                            vfat   umask=0077
/data     /dev/sdb1                                 ext4   defaults,noatime
/tmp      tmpfs                                     tmpfs  size=2G,mode=1777
/mnt/home server:/export/home                       nfs    defaults,_netdev

-s reads /etc/fstab; -F FILE (--tab-file) reads any file in that format, as here. The result is the same table as for live mounts, which is easier to check than the raw file.

Check an fstab for mistakes

fstab
proc       /proc      proc   defaults           0 0
tmpfs      /tmp       tmpfs  size=1G,mode=1777  0 0
/dev/sdc1  /backup    ext5   defaults           0 2
findmnt --verify --tab-file fstab
explain
outputexit 1

0 parse errors, 1 error, 3 warnings
/backup
   [E] unreachable on boot required target: No such file or directory
   [W] unreachable source: /dev/sdc1: No such file or directory
   [W] ext5 seems unsupported by the current kernel
   [W] cannot detect on-disk filesystem type (No such file or directory)

--verify checks every entry: does the source exist, does the target directory exist, is the filesystem type known. The /backup line has a typo (ext5), and neither /dev/sdc1 nor /backup exists in this sandbox. Run findmnt --verify (it reads /etc/fstab by default) before rebooting after an fstab edit.

Common pitfalls

  • A directory that should be a mount point but is not looks exactly like an empty mounted filesystem; scripts that write backups there fill the root disk. Check with findmnt (or mountpoint -q) first.

  • findmnt PATH only matches when PATH is itself a mount point. To find the filesystem that contains a path, use -T.

GNU vs BSD and macOS

The examples above ran the GNU/Linux version. These are the differences that matter on macOS and the BSDs (written from their documentation, not run here).

  • findmnt is Linux-only (util-linux). On macOS and BSD, mount with no arguments and df PATH cover the same questions.

Options worth knowing

A selection, described in our own words. For the full list, see findmnt(8) or findmnt --help.

OptionWhat it does
-T, --target PATHShow the filesystem that contains PATH.
-S, --source SPECMatch mounts by source device or spec.
-M, --mountpoint PATHMatch mounts by mount point.
-t, --types LISTOnly filesystems of these types.
-O, --options LISTOnly mounts with these options.
-o, --output LISTPrint the listed columns.
-n, --noheadingsOmit the header line.
-l, --listPlain list instead of a tree.
-r, --rawRaw output for parsing.
-J, --jsonPrint JSON.
-D, --dfShow df-style size and usage columns.
-s, --fstabRead /etc/fstab instead of the live mount table.
-F, --tab-file FILERead mounts from FILE.
-x, --verifyCheck an fstab file for errors.
--realOnly real filesystems, not pseudo ones.
-R, --submountsInclude mounts below the matched one.
-f, --first-onlyPrint only the first match.
-p, --poll[=LIST]Watch for mount, umount, remount or move events.

Related