Badblocks - search a device for bad blocks

Important note: If the output of badblocks is going to be fed to the e2fsck or mke2fs programs, it is important that the block size is properly specified, since the block numbers which are generated are very dependent on the block size in use by the filesystem. For this reason, it is strongly recommended that users not run badblocks directly, but rather use the -c option of the e2fsck and mke2fs programs.

badblocks -nvs /dev/sdb

This would check the drive “sdb” in non-destructive read-write mode and display progress by writing out the block numbers as they are checked.

badblocks -wvs /dev/sdb6

This would check the sixth partition of the drive “sdb”, in destructive read-write mode and display progress by writing out the block numbers as they are checked. All data will be overwritten at the block level. If used on an entire disk as in the previous example, it destroys MBRs, partitions and data alike.

Comments are closed.