The essentials
Quick reference
One focused task per row. Jump to the related section for complete, working examples.
| Use | Syntax | Examples |
|---|---|---|
| Show block-device topology | lsblk -o \
NAME,TYPE,SIZE,FSTYPE,FSVER,LABEL,UUID,MOUNTPOINTS | View examples |
| Show filesystem overview | lsblk --fs | View examples |
| Probe a specific device | sudo blkid /dev/sdb1 | View examples |
| List mounted filesystems | findmnt --real --output TARGET,SOURCE,FSTYPE,OPTIONS | View examples |
| Resolve a path's mount | findmnt --target /var/lib/app | View examples |
| Test a mount point | mountpoint --quiet /mnt/archive | View examples |
| Show filesystem capacity | df -hT /var/lib/app | View examples |
| Show inode capacity | df -ih /var/lib/app | View examples |
| Measure one tree | du -sh -- /var/lib/app | View examples |
| Compare top-level children | du -xhd1 -- /var/lib/app | sort -h | View examples |
| Verify fstab | sudo findmnt --verify --verbose | View examples |
| Mount read-only | sudo mount --read-only --source /dev/sdb1 --target \
/mnt/review | View examples |
| Unmount by target | sudo umount -- /mnt/review | View examples |
| Synchronize one file | sync --data /var/lib/app/database.db | View examples |
| Find mount users | sudo fuser --mount --verbose /mnt/review | View examples |
| Inspect open paths | sudo lsof +D /mnt/review | View 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
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.
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.
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.
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 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.
df -hT /var/lib/app
df -ih /var/lib/app 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.
sudo du -xhd1 -- /var/lib | sort -h
sudo du -sh -- /var/lib/app 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.
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.
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.
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.
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.
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.
Sources and further reading
References
Authoritative documentation used to verify and expand this cheat sheet.
- Linux man-pages projectlsblk(8) — list block devicesman7.org
- Linux man-pages projectfindmnt(8) — find a filesystemman7.org
- Linux man-pages projectmount(8) — mount a filesystemman7.org
- Linux man-pages projectumount(8) — unmount filesystemsman7.org
- GNU Projectdf invocationgnu.org
- 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.



