Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

share|improve this question
up vote 56 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.

The program is bundled in the gnome-disk-utility package.

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.

share|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
Actually badblocks's manual discourages from using it directly and directs users to e2fsck with "-c" (for read only check) or "-cc" (for read write check) option. – mrówa Apr 29 '13 at 21:01
as a note, on 13.04 you run palimpsest by just running "disks" from the ubuntu menu, however...I dont' see an option to launch a self-test (possibly because I have only one drive, and it's the one running Ubuntu...) – rogerdpack Oct 11 '13 at 14:04
@mrówa the manual only says to do that if "the output of badblocks is going to be fed to the e2fsck or mke2fs programs" – Jon Dec 23 '13 at 14:31
this is now called gnome-disks – endolith Mar 2 '14 at 0:47

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.

share|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

You can check for badblocks running the command sudo badblocks -nsv /dev/[device-partition] > bad-blocks for a non-destructive read-write test. That will generate a file called bad-blocks with the sectors damaged. Then, you can run sudo fsck -t ext3 -l bad-blocks /dev/[device-partition] to tell the file system where the bad sectors are and move data away from them, if possible.

You can find more reading about it here:

share|improve this answer
To continue with badblocks later or if you forgot to export the bad sector to a text file (like me) this answer will help you: – chelder Jan 21 '15 at 18:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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