r/LinuxTeck • u/Expensive-Rice-2052 • 6d ago
Quick Linux Tip #123 - Linux Filesystem Check: 3 Commands to Detect Disk Errors
Question: How do I check if my mounted filesystem is corrupted?
Try:`sudo touch /forcefsck && sudo shutdown -r +1 'Scheduled fsck'`
Info: Triggers boot-time checks, while read-only flags safely audit mounted filesystems instantly.
Examples:
$ `sudo tune2fs -c 1 /dev/sda1` # Force a filesystem check after every mount count
$ `sudo fsck -y /dev/sdb1` # Automatically repair an unmounted filesystem
$ `sudo xfs_repair -n /dev/sda1` # Perform a dry-run check on an XFS filesystem
Note: Read-only audits are safe but limited; actual repairs require unmounted filesystems. Different filesystems require dedicated utilities like `xfs_repair` or `btrfs check`. Always create a full backup before attempting repairs.
Want to master Linux one command at a time?
Follow r/LinuxTeck - 1 practical Linux tip every day. For more #LinuxTips click here https://www.linuxteck.com/linux-tips/
2
u/michaelpaoli 2d ago
That doesn't generally detect disk errors. It mostly only checks/repairs filesystem metadata.