I suspect there might be bad sector on a disk. What tool is the best equivalent of the error checking tool of windows?

(I used ext3)

link|improve this question

69% accept rate
feedback

2 Answers

up vote 3 down vote accepted

To check for bad sectors check the SMART data, probably the best accessible by launching the Disk Utility (Palimpsest). Even if you don't see any bad blocks there, launch a self-test to be sure.

SMART from Palimpsest

You can also use badblocks

sudo badblocks -sv /dev/sda

will check the whole disk and print out all bad blocks encountered on /dev/sda.

fsck itself will not help you find bad sectors, worse still, if there are a lot of bad sectors it can damage your data even more. Use it only when the disk is healthy.

link|improve this answer
Thanks a lot, that gave me the bad sector info I was looking for. – Guillaume Coté Aug 30 '11 at 1:04
feedback

fsck - check and repair a Linux file system. Invoke it using

fsck /dev/sda1

where /dev/sda1 is the drive you want to check. See 'man fsck' for more details.

There's also 'badblocks' command which checks a device for, you guessed it, bad blocks.

The drive need to be unmounted when checked, so to check the root partition you need to create a file 'forcefsck' in the root of the partition and reboot. The device will be checked upon the next boot:

sudo touch /forcefsck
sudo reboot

Alternatively, you can boot from a Live CD and run the check from there.

link|improve this answer
Thanks, the machine is running without a monitor, is there a way to access the output of the check after the reboot? – Guillaume Coté Aug 29 '11 at 3:58
I created the file and rebooted, but it was really quick and there is nothing new in the boot.log. – Guillaume Coté Aug 29 '11 at 4:14
fsck just do a very quick check, I tried option -c to check for the bad block. – Guillaume Coté Aug 29 '11 at 7:00
fsck -c just said : /dev/sda9: Updating bad block inode. I have no info on how many bad node and which proportion of the file system they represent. – Guillaume Coté Aug 29 '11 at 14:09
sudo dumpe2fs -b /dev/sda9. But I think it is better if the disk takes care of faulty sectors, not the filesystem (SMART, badblocks etc, see my post). – arrange Aug 29 '11 at 16:29
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.