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)
| Command | Description | When to Use |
|---|---|---|
fsck -fy /dev/diskXsY | Force 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_apfs | APFS-specific version of fsck (used automatically for APFS volumes). | Modern macOS with APFS drives. |
fsck_hfs | HFS+ specific version (older Mac OS Extended format). | Legacy drives formatted as JHFS+. |
How to Run fsck
On macOS – For Non-Startup Volumes
- Open Terminal (Finder → Utilities → Terminal).
- Identify the disk:
diskutil list(look for the identifier like /dev/disk2s1). - Unmount the volume:
diskutil unmount /dev/disk2s1. - Run fsck:
fsck -fy /dev/disk2s1. - Remount if needed:
diskutil mount /dev/disk2s1.
On macOS – For Startup Disk (must repair from outside)
- Restart and hold Cmd+S for Single-User Mode (older macOS) – OR – hold Cmd+R for Recovery Mode and use Terminal from there.
- In Single-User Mode, run:
/sbin/fsck -fy. - If errors found, run it again until output shows “The volume (name) appears to be OK”.
- Type
rebootto restart normally.
On Linux
- Unmount the target:
sudo umount /dev/sdb1. - Run fsck:
sudo fsck -y /dev/sdb1(-y auto-repairs all fixes). - Remount:
sudo mount /dev/sdb1 /mnt. - For root partition, boot from a live USB to run fsck.
Common Flags
| Flag | Meaning |
|---|---|
-f | Force check even if file system appears clean. |
-y | Auto-answer “yes” to all repair prompts. |
-n | Open in read-only mode; no modifications (check only). |
-v | Verbose 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.
