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

2 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.

Leave a reply