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



its useful
how to add bad blocks in super block inode? possible some examples.
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.