badblocks is a small program for stress testing block devices. Similar to memtest86+, badblocks reads and writes small patterns of bytes to block devices.
badblocks comes as part of the sys-fs/e2fsprogs package and should be available as part of the default system profile.
Usage: /sbin/badblocks [-b block_size] [-i input_file] [-o output_file] [-svwnf] [-c blocks_at_once] [-d delay_factor_between_reads] [-e max_bad_blocks] [-p num_passes] [-t test_pattern [-t test_pattern [...]]] device [last_block [first_block]]
Test a drive
To test a drive with visual progress use the
-w options followed by the path to the block device.
All data on the device will be completely overwritten and destroyed; be sure to create backups as needed to preserve data that should be saved!
badblocks -s -w /dev/<device>
<device> in the command above with the block device that is to be tested. badblocks should run through a series of four tests and return output similar to the following:
Testing with pattern 0xaa: done Reading and comparing: done Testing with pattern 0x55: done Reading and comparing: done Testing with pattern 0xff: done Reading and comparing: done Testing with pattern 0x00: done Reading and comparing: done
badblocks also supports a non-destructive read-write mode when using the
-n option instead of
-w. Users are advised to create backups nonetheless.