The essentials

Quick reference

One focused task per row. Jump to the related section for complete, working examples.

UseSyntaxExamples
Show block-device topologylsblk -o \ NAME,TYPE,SIZE,FSTYPE,FSVER,LABEL,UUID,MOUNTPOINTSView examples
Show filesystem overviewlsblk --fsView examples
Probe a specific devicesudo blkid /dev/sdb1View examples
List mounted filesystemsfindmnt --real --output TARGET,SOURCE,FSTYPE,OPTIONSView examples
Resolve a path's mountfindmnt --target /var/lib/appView examples
Test a mount pointmountpoint --quiet /mnt/archiveView examples
Show filesystem capacitydf -hT /var/lib/appView examples
Show inode capacitydf -ih /var/lib/appView examples
Measure one treedu -sh -- /var/lib/appView examples
Compare top-level childrendu -xhd1 -- /var/lib/app | sort -hView examples
Verify fstabsudo findmnt --verify --verboseView examples
Mount read-onlysudo mount --read-only --source /dev/sdb1 --target \ /mnt/reviewView examples
Unmount by targetsudo umount -- /mnt/reviewView examples
Synchronize one filesync --data /var/lib/app/database.dbView examples
Find mount userssudo fuser --mount --verbose /mnt/reviewView examples
Inspect open pathssudo lsof +D /mnt/reviewView examples

Storage work is safest when device identity, filesystem identity, and mount location are treated as separate facts. Inspect before changing anything, use stable UUID-based configuration, verify space and inode pressure independently, and unmount cleanly before maintenance. Formatting and repair commands are intentionally outside this quick reference because they require device-specific recovery planning.

Step by step

Detailed examples

01

Identify the device and filesystem separately

lsblk describes block-device relationships using sysfs and udev information, while blkid probes filesystem signatures. Always request explicit lsblk columns because its default output can change. Device names such as /dev/sdb may change across boots; UUID and labels are more stable identifiers after you verify they are unique.

Inventory devices with stable identifiers
lsblk -o NAME,PATH,TYPE,SIZE,FSTYPE,FSVER,LABEL,UUID,MOUNTPOINTS
sudo blkid /dev/sdb1

Note: Replace /dev/sdb1 only after confirming the intended device from the topology and your infrastructure records.

Back to quick reference ↑
02

Ask the mount table which filesystem owns a path

findmnt reads the kernel mount table and can filter by target, source, type, or options. A mount source may appear as a device, UUID, network path, or virtual filesystem. mountpoint is useful in scripts because its exit status distinguishes a mount point from an ordinary directory.

Resolve an application path
findmnt --target /var/lib/app --output TARGET,SOURCE,FSTYPE,OPTIONS
if mountpoint --quiet /mnt/archive; then
  printf 'archive is mounted\n'
else
  printf 'archive is not mounted\n' >&2
fi
Back to quick reference ↑
03

Check both byte blocks and inodes

df reports allocation at filesystem level, not the size of each directory. A filesystem can have free bytes but no free inodes, especially after accumulating many small files. Deleted files held open by running processes can also keep blocks allocated even though directory scans no longer find them.

Compare capacity dimensions
df -hT /var/lib/app
df -ih /var/lib/app
Back to quick reference ↑
04

Attribute usage without crossing filesystems accidentally

du walks directory entries, so it can be slower and can disagree with df because they measure different views. `-x` stays on one filesystem and prevents a scan from descending into nested mounts. Start at a shallow depth, narrow the path, and preserve `--` before paths that might begin with a dash.

Find large top-level directories
sudo du -xhd1 -- /var/lib | sort -h
sudo du -sh -- /var/lib/app
Back to quick reference ↑
05

Use stable fstab identifiers and verify before reboot

/etc/fstab maps sources to targets, filesystem types, options, dump behavior, and fsck order. Prefer UUID= values for local filesystems and create the target directory first. Back up the file, edit one intended entry, and run findmnt --verify; verification catches many errors but cannot guarantee a remote service or device will be available later.

Inspect and validate persistent configuration
findmnt --fstab --output SOURCE,TARGET,FSTYPE,OPTIONS
sudo findmnt --verify --verbose

Note: Review verification output before testing a new mount or rebooting; this example does not edit /etc/fstab.

Back to quick reference ↑
06

Mount only after validating source and target

mount attaches a filesystem to the directory tree; anything previously visible under the target is hidden until unmount. A read-only mount reduces accidental writes but does not make an untrusted filesystem parser risk-free. Before unmounting, stop writers, leave the directory in every shell, synchronize required data, and target the exact mount point.

Review an identified filesystem read-only
findmnt --source /dev/sdb1
sudo mount --read-only --source /dev/sdb1 --target /mnt/review
findmnt --target /mnt/review
# After review and after leaving the directory:
sudo umount -- /mnt/review

Note: Use only a device and target you have independently identified; mounting changes system state.

Back to quick reference ↑
07

Diagnose busy mounts before forcing anything

An unmount normally fails while a process uses the filesystem. fuser can identify process IDs by mount and lsof can inspect open paths, though recursive +D scans are expensive. Stop or redirect those processes cleanly. Lazy or forced unmounts have failure and data-integrity tradeoffs and should not be the default response.

Find users and flush required data
sudo fuser --mount --verbose /mnt/review
sudo lsof +D /mnt/review
sync --data /var/lib/app/database.db

Note: sync requests writeback; application-level consistency may still require the application to flush or close its own state first.

Back to quick reference ↑

Sources and further reading

References

Authoritative documentation used to verify and expand this cheat sheet.

  1. Linux man-pages projectlsblk(8) — list block devicesman7.org
  2. Linux man-pages projectfindmnt(8) — find a filesystemman7.org
  3. Linux man-pages projectmount(8) — mount a filesystemman7.org
  4. Linux man-pages projectumount(8) — unmount filesystemsman7.org
  5. GNU Projectdf invocationgnu.org
  6. GNU Projectdu invocationgnu.org

Help us improve

Found a typo or missing example?

Tell us what would make this cheat sheet clearer, more complete, or more useful.

Share feedback