fsck
Check and repair Linux filesystems for errors and inconsistencies.
Synopsis
fsck [OPTION]... [DEVICE]...
Examples
sudo fsck /dev/sda1
sudo fsck -y /dev/sdb1
sudo fsck -n /dev/sda2
sudo fsck -f /dev/sda1
Common options
| Flag | Description |
|---|---|
| -y | Assume yes to all questions |
| -n | Assume no — check only |
| -f | Force check even if clean |
| -t | Specify filesystem type |
| -p | Auto-repair (safe fixes only) |
About fsck
The `fsck` command check and repair Linux filesystems for errors and inconsistencies. Disk commands handle low-level storage operations including partitioning, formatting, filesystem checks, and block device management.
These tools are critical during system installation, storage expansion, data recovery, and performance tuning. Always exercise caution — disk operations can cause data loss if used incorrectly.
The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man fsck`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Disk Commands
Other commands in the Disk category