(linux_command_line)-> check disk for errors
submited by Russell Mon 24 Jan 05|
Edited Wed 11 Jan 06
quick check disk:
(replace /dev/hdc2 with the partition you want to check)
To force a check , even if the drive does not appear to contain errors:
/sbin/e2fsck -f /dev/hdc2
To perform an agressive, but non destructive, check for bad spots on the disk use:
/sbin/e2fsck -c -c -v -C /dev/hdc2
-C displays a progress bar this is nice when the disk is large and the check could take a long time.
you can also use fsck, this will figure out the drive type and end up calling e2fsck if the partition is an ext2 or ex3 filesystem.
you can, but should not run (e2)fsck on a mounted drive. If you can't unmount the drive. get a bootable CD (like knoppix or use a fedora install CD and boot linux rescue ), Do not mount the local filesystem, and run fsck on the partition in question.
I can't stress that enough!! I had a drive that got messed up that I ran fsck on while mounted several times. The rpm database got messed up and I ended up needing to do a full re-install.
a good way to get around this problem (needing to run fsck on a mounted filesystem) is to use tune2fs to set the system to check the disk for errors on the next boot. ( this way it will check before the drive is mounted)
/sbin/tune2fs -C 9999 -T 19700101 /dev/hda2
Sets the "time between checks number (mount-count)" so high that a fresh check must be required, and sets the "last checked" date to "Jan 1 00:00:00 1970". This will force a check on the next reboot unless you have specificly turned auto checking off. You can check the settings with
/sbin/tune2fs -l device
Among other things this displays:
So long as at least one of those isn't set to 0 (don't check) the system will perform a fsck (checkdisk) on the next boot.
Maximum mount count: 20
Check interval: 15552000 (6 months)
Now if you want to stop automatic checks, use
/sbin/tune2fs -i 0 -c 0 device
read the tune2fs manpage for details. But just don't do this without some plan for checking the disk manualy.
Redhat fsck 7.3 boot fail recovery (Russell)
hard disk recovery utils (Russell)
Add comment or question...: