Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

findmnt

Show mounted file systems as a tree, find one mount, or check /etc/fstab for errors.

Niveau
RHCSA-examen
Groep
Schijven en bestandssystemen
Root nodig
Nee
Pakket
util-linux

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

findmnt lists all mounts with source, type and options — clearer than mount. With a folder or device it shows only that mount. findmnt --verify checks every line of /etc/fstab (devices, mount points, types) — use it after editing fstab, before a reboot.

Zo schrijf je het

findmnt [OPTION]... [DEVICE|MOUNTPOINT]
findmnt [OPTION]... [--source] DEVICE [--target PATH]

Opties 43

Meest gebruikt

Select

-s, --fstab
Look in /etc/fstab instead of the kernel list.
-m, --mtab
Look in /etc/mtab.
-k, --kernel
Look in the kernel mount table (default).
-t, --types LIST
Only these types (like xfs,ext4; noxfs = not).
-O, --options LIST
Only mounts with these options.
-S, --source SPEC
Search by source (device, UUID=, LABEL=).
-T, --target PATH
Search by mount point (or the mount that contains PATH).
-M, --mountpoint PATH
Same as --target.
-N, --task TID
Use the mount namespace of this task.
-R, --submounts
Also show the sub-mounts.
-f, --first-only
Only the first match.
--real
Only real file systems.
--pseudo
Only pseudo file systems.
--shadow, --shadowed
Only mounts hidden by another mount.
--deleted
Only mounts of deleted files.
-d, --direction forward|backward
Search direction.
-F, --tab-file PATH
Use another file.

Check

-x, --verify
Check the fstab file for errors.
--verbose
More detail with --verify.
-p, --poll[=LIST]
Watch for mount changes (mount, umount, remount, move).
-w, --timeout MS
Stop polling after this time.

Output

-D, --df
Output like df (size, used, avail).
-o, --output LIST
Choose columns (SOURCE,TARGET,FSTYPE,OPTIONS,UUID …).
--output-all
All columns.
-n, --noheadings
No header line.
-l, --list
List instead of a tree.
--tree
Tree output (default).
-r, --raw
Raw output.
-P, --pairs
KEY="value" output.
-J, --json
JSON output.
-y, --shell
Column names usable as shell variables.
-e, --evaluate
Turn LABEL=/UUID= into device names.
-c, --canonicalize
Canonical paths.
-C, --nocanonicalize
Do not resolve paths.
-v, --nofsroot
Do not show [/dir] for bind mounts.
-U, --uniq
Ignore duplicates.
-u, --notruncate
Do not cut text.
-a, --ascii
ASCII tree lines.
-b, --bytes
Sizes in bytes.
-i, --invert
Invert the -t and -O match.
--vfs-all
Show all VFS options.
-h, --help
Show help.
-V, --version
Show the version.

Voorbeelden 11

$ als gewone gebruiker# als root (of met sudo)

  1. 1All mounts as a tree

    findmnt

    Source, type and options for every mount.

  2. 2One mount point

    findmnt /data
    TARGET SOURCE    FSTYPE OPTIONS
    /data  /dev/vdb1 xfs    rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota

    Exit code 1 when nothing is mounted there.

  3. 3Check /etc/fstab before reboot

    findmnt --verify
    Success, no errors or warnings detected

    Catches wrong UUIDs, missing folders and typos.

  4. 4Only real disk file systems

    findmnt -t xfs,ext4,vfat

    Without proc, sys, cgroup …

  5. 5Like df

    findmnt -D

    Size and use per mount.

  6. 6Which file system holds a file?

    findmnt -T /var/log/messages

    Shows the mount that contains this path.

  7. 7What is in fstab?

    findmnt -s

    The fstab lines as a table.

  8. 8Find mounts without noexec (security)

    findmnt -O noexec -i -n -o TARGET -t xfs,ext4,tmpfs

    Folders where users could run programs.

  9. 9Get the device of a mount for scripts

    findmnt -n -o SOURCE /
    /dev/mapper/rhel-root

    Clean value.

  10. 10Watch mount changes live

    findmnt -p

    Shows mounts and unmounts as they happen (Ctrl+C to stop).

  11. 11JSON for monitoring

    findmnt -J -o TARGET,FSTYPE,SIZE,USE% -t xfs

    Feed a dashboard.

Exitcodes

0 :: Found (or verify OK). 1 :: Nothing found (or verify found errors).