Filesystem Checks and Storage Health
Quick answer
Filesystem consistency and physical storage health are different. A filesystem check examines metadata; SMART reports device health information where supported. Neither replaces a verified backup.
Prepare the practice environment
Run python3 lab-fixtures/storage/setup.py from the extracted root as an ordinary user. Enter the printed fresh private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. Only disposable regular files may be written. Optional examples require an authorized snapshot VM. Never substitute actual devices or modify mounts, system configuration or active swap. Review the lab guide.
How it works
fsck dispatches filesystem-specific checkers; ext4 uses e2fsck, while XFS and Btrfs require their own tools and recovery guidance. Do not repair a mounted filesystem. fsck -N prints planned checker commands without executing them. fstrim discards unused blocks on supported mounted filesystems; it is not a repair or secure erase. Quotas restrict usage for users, groups or projects depending on filesystem. SMART attributes and error logs are device-specific; a passing status cannot guarantee future health. If failure is suspected, prioritize data preservation and qualified recovery over repeated repair attempts.
A checker can report structural problems while a file still reads correctly, or find no structural problems while an application file contains the wrong bytes. A checksum comparison tests a different property. Record the checker name, target, status and whether it was only a preview. If storage is failing, do not interpret a clean result as permission to repeatedly stress the device.
Try the examples
awk -F= '$1=="pending_sectors" {print $2}' health.txtSynthetic pending-sector count is a reason to investigate and protect data, not a universal SMART threshold.
Expected stdout:
4This verifies documented option availability only; it performs no check or repair.
Expected stdout:
-NVM only; prepare a fresh ext4 image using the previous lesson. The command displays planned operations, not a consistency result.
Manual example; not executed locally. Follow its stated environment restrictions.
Common mistakes
Never use automatic repair flags on a mounted or unidentified device. SMART passed does not establish that backups are unnecessary.
Practice
Read health.txt and distinguish device health, filesystem consistency, discard and quota. Write a safe investigation plan without repairing or trimming any storage.
Related references
Study: fsck, fstrim, smartctl, quota. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Filesystem checks and storage health — Knowledge Check
Apply storage concepts to synthetic fixtures and VM-only scenarios.
What does fsck -N do?
What does fstrim address?
What does SMART passing guarantee?
What restricts per-user usage?