Detecting and Marking Bad Blocks in Linux

To detect bad blocks on a disk in a system running Linux use:

badblocks -v /dev/sdX -o badblockFile.txt

Where “X” is the drive letter, and “badblockFile.txt” will contain a listing of any bad blocks found.

Now to mark those bad blocks, unmount the disk (unless it is running the operating system), and use e2fsck:

e2fsck -l badblockFile.txt /dev/sdX

If the disk in question is a boot disk, you will need to shutdown the machine and restart using a Live CD before performing the e2fsck operation.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.