Badblocks

From Wikipedia, the free encyclopedia

badblocks is a Linux utility to check for damaged sectors on a disk drive. It marks these sectors so that they are not used in the future and thus do not cause corruption of data.

When run standalone, badblocks gives a list of blocks with problems. Badblocks is not usually invoked by itself unless you want a list of badblocks on the hard disk. Badblocks is usually invoked as an option of 'e2fsck' - Please refer man page of 'e2fsck' on how this is done. When invoked with 'e2fsck' -- quoting the man page:

            'This  option  causes  e2fsck to use badblocks(8) program to do a
             read-only scan of the device in order to find  any  bad  blocks.
             If  any  bad  blocks  are found, they are added to the bad block
             inode to prevent them from being allocated to a file  or  direc-
             tory.   If  this  option  is specified twice, then the bad block
             scan will be done using a non-destructive read-write test.'

Please check the man pages of 'fsck' and 'badblocks' and for the intrepid techie, this is a good link -[1]. If you are a casual user, this link might be confusing.

[edit] Example

badblocks -sv /dev/sdb1