Name
badblocks
Synopsis
badblocks [options]deviceblock-count
System administration command. Search device for bad blocks. You must specify the number of blocks on the device (block-count). e2fsck and mke2fs will invoke badblocks automatically when given the -c option.
Options
- -b blocksize
Expect blocksize-byte blocks.
- -c blocksize
Test blocksize-byte blocks at a time. Default is 16.
- -e number
Abort test after finding specified number of blocks.
- -f
Force a read/write or nondestructive write test on a mounted device. Use only when /etc/mtab incorrectly reports a device as mounted.
- -i file
Skip test of known bad blocks listed in file.
- -n
Perform a nondestructive test by writing to each block and then reading back from it while preserving data.
- -o file
Direct output to file.
- -p number
Repeat search of device until no new bad blocks have been found in number passes. Default is 0.
- -s
Show block numbers as they are checked.
- -t pattern
Test blocks by reading and writing the specified pattern. You may specify pattern as a positive integer or as the word random. If you specify multiple patterns, badblocks tests all blocks with one pattern, and then tests all blocks again with the next pattern. Read-only mode accepts only one pattern. It does not accept random.
- -v
Verbose mode.
- -w
Test by writing to each block and then reading back from it. This option will destroy data. Don’t use it on devices that contain filesystems.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access