Posted in

fsck

fsck (File System Consistency Check) is a command-line utility on macOS and Linux for checking and repairing file system integrity. It is the low-level tool that Disk Utility’s First Aid and Windows’ CHKDSK are built upon.

How It Works

  • Check only: Scans the file system and reports errors without making changes.
  • Repair: With appropriate flags, attempts to fix corrupted structures, orphaned inodes, and other file system issues.
  • Unmounted required: For most file systems, the target volume must be unmounted before running repair (except for certain live modes).

Common fsck Commands (macOS)

CommandDescriptionWhen to Use
fsck -fy /dev/diskXsYForce repair on a specific volume (y=yes to repair, f=force).When a non-startup volume has errors and is unmounted.
fsck -fy /Check and repair the startup volume (only works in single-user or Recovery Mode).If the Mac won’t boot normally due to disk corruption.
diskutil verifyVolume /Uses fsck internally to verify but does not repair.Safe check without making changes.
diskutil repairVolume /Uses fsck to repair (requires unmount or Recovery Mode).Preferred over raw fsck for most users.
fsck_apfsAPFS-specific version of fsck (used automatically for APFS volumes).Modern macOS with APFS drives.
fsck_hfsHFS+ specific version (older Mac OS Extended format).Legacy drives formatted as JHFS+.

How to Run fsck

On macOS – For Non-Startup Volumes

  1. Open Terminal (Finder → Utilities → Terminal).
  2. Identify the disk: diskutil list (look for the identifier like /dev/disk2s1).
  3. Unmount the volume: diskutil unmount /dev/disk2s1.
  4. Run fsck: fsck -fy /dev/disk2s1.
  5. Remount if needed: diskutil mount /dev/disk2s1.

On macOS – For Startup Disk (must repair from outside)

  1. Restart and hold Cmd+S for Single-User Mode (older macOS) – OR – hold Cmd+R for Recovery Mode and use Terminal from there.
  2. In Single-User Mode, run: /sbin/fsck -fy.
  3. If errors found, run it again until output shows “The volume (name) appears to be OK”.
  4. Type reboot to restart normally.

On Linux

  1. Unmount the target: sudo umount /dev/sdb1.
  2. Run fsck: sudo fsck -y /dev/sdb1 (-y auto-repairs all fixes).
  3. Remount: sudo mount /dev/sdb1 /mnt.
  4. For root partition, boot from a live USB to run fsck.

Common Flags

FlagMeaning
-fForce check even if file system appears clean.
-yAuto-answer “yes” to all repair prompts.
-nOpen in read-only mode; no modifications (check only).
-vVerbose output (shows detailed progress).

Important Notes

  • Unmount first: Running repair on a mounted volume (except for some live file systems) can cause severe data loss. Always unmount unless instructed otherwise.
  • Run repeatedly: Sometimes fsck needs to be run multiple times until it reports “clean” with no errors.
  • Hardware failure: fsck fixes logical errors, not physical bad sectors. If errors persist, the drive may be failing.
  • Backup: Always have a recent backup before running fsck – repairs can sometimes move orphaned files to a lost+found folder or cause data loss if corruption is severe.
  • APFS snapshots: On APFS, fsck works with snapshots; running repair may revert some changes to a known-good snapshot state.

Leave a Reply

💠

🔵 Best-selling hard drives, USB flash drives & SSDs everyone's buying.

Fast, reliable, and on sale now. Thousands pick these weekly — don't miss Amazon's lowest storage prices.

Top 10 Bestsellers
🏆 4.7★+ Reviews
📦 Prime Shipping
👉 See today's best-selling Data storage on Amazon.com HDD · USB Flash Drives · SSD · External Drives
🛒
✅ Updated hourly — Amazon real-time ranking 🔥 Limited stock deals 🔗 Affiliate
⭐ Click to see complete best-selling list ⭐