Commands · Command
CommandLinuxmacOS
fsck
fsck [options] deviceChecks a filesystem for consistency errors and repairs them — the standard tool after an unclean shutdown or suspected disk corruption.
// FLAGS
-yautomatically answer "yes" to all repair prompts-fforce a check even if the filesystem looks clean-ncheck only, don't repair// EXAMPLE
fsck -y /dev/sda1 — checks and automatically repairs any errors found on that partition.
// GOTCHA
fsck should never be run on a mounted, in-use filesystem — doing so can cause the exact corruption it's meant to fix; unmount it first, or run it from a live/rescue environment for the root filesystem.
// RELATED COMMANDS