fsck Command
Check and repair filesystem inconsistencies to ensure data integrity and fix errors that may occur due to improper shutdowns or hardware issues.
Syntax
The fsck command checks and repairs filesystem inconsistencies, ensuring data integrity and fixing errors that may occur due to improper shutdowns or hardware issues.
Basic Usage
Check a specific filesystem
Check a specific device or partition for filesystem errors
Check all filesystems
Check all filesystems defined in the system configuration
Interactive and automatic modes
Choose between interactive repair or automatic error correction
Common Options
Filesystem type options
Specify or auto-detect the filesystem type for checking
Repair options
Control how fsck handles repairs and checks
Output and logging
Control the amount of information displayed during checking
Practical Examples
System administration tasks
Common administrative tasks using fsck
Recovery scenarios
Recovery procedures for damaged filesystems
Maintenance and monitoring
Routine maintenance and health checking
Best Practices
fsck Best Practices
- Always unmount filesystems before running fsck
- Use recovery mode or live CD for root filesystem
- Backup important data before major repairs
- Use appropriate filesystem type detection
- Monitor fsck output for critical errors
- Run fsck after improper shutdowns
Common Pitfalls
- Mounted filesystems - Never run fsck on mounted filesystems
- Data loss - Automatic repair may result in data loss
- Wrong device - Double-check device names before running
- Interruption - Don't interrupt fsck during operation
- Multiple instances - Don't run multiple fsck instances simultaneously