How to check for bad blocks

Scenario / Question:

How do I check my hard drive for bad blocks and if any bad blocks are found add them to the bad block inode to prevent them from being allocated in the future.

Solution / Answer:

Run fsck and have it run bad blocks program. This allows fsck to fix any bad blocks that are found.

Bad Blocks read only test (non-destructive):

**Recommended to run fsck command on an unmounted partition**

View this post for how to run fsck: “How should I run fsck on a Linux file system

To run bad blocks with the read-only option and verbose output:

-c – use bad blocks read non-destructive

-v – verbose output

# fsck -vc /dev/sdb1

Bad Blocks read-wrte test (non-destructive):

**Recommended to run fsck command on an unmounted partition**

View this post for how to run fsck: “How should I run fsck on a Linux file system

To run bad blocks with the read-write option and verbose output:

-cc – use bad blocks read-write non-destructive

-v – verbose output

# fsck -vcc /dev/sdb1
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Fabio Milano has written 70 articles for us. Fabio Milano is a certified RHCE, MCP, and CFOI. He runs an IT consulting and services company called RDS Support inc. Website:http://www.rdssupport.com

3 Comments so far

  1. madhu on July 15th, 2009

    its useful

  2. madhu on July 15th, 2009

    how to add bad blocks in super block inode? possible some examples.

  3. Gen2ly on March 22nd, 2010

    fsck -vc/-vcc calls the program badblocks to do this test. Unfortunately (I’m pretty sure) fsck is only capable of doing this on Linux filesystems (ext 2/3/4?). If you want to do a full drive test, use badblocks directly:

    badblocks -nvs /dev/hda

    Unfortunately, I’m not sure this will record the badblocks. In fact I’m thinking it may not, but at least you can find if they exist. Badblock I believe are recorded in the filesystem metadata meaning that if, for example, you have an NTFS partition on the drive, you’ll probably have to use the MS toold like chkdisk.

Leave a reply