info > BADBLOCKS

๐Ÿ“› NAME

badblocks โ€” search a device for bad blocks

๐Ÿš€ Quick Reference

Use CaseCommandDescription
Basic read-only scanbadblocks /dev/sda1Scan a partition for bad blocks using default read-only test.
Non-destructive read-write testbadblocks -n /dev/sda1Perform a non-destructive read-write test (preserves data).
Destructive write-mode testbadblocks -w /dev/sda1Perform a destructive write-mode test (erases data!).
Output list to filebadblocks -o badblocks.txt /dev/sda1Write the list of bad blocks to a file.
Show scan progressbadblocks -s /dev/sda1Show percentage completion during the scan.
Specify block sizebadblocks -b 4096 /dev/sda1Scan using a specific block size.
Limit scan to first N blocksbadblocks /dev/sda1 100000Scan only the first 100,000 blocks.
Skip existing bad blocksbadblocks -i known_bad.txt /dev/sda1Skip blocks listed in a file.

๐Ÿ“œ SYNOPSIS

badblocks  [  -svwnfBX  ]  [ -b block_size ] [ -c blocks_at_once ] [ -d
       read_delay_factor ] [ -e max_bad_blocks ] [ -i input_file ] [  -o  out-
       put_file  ] [ -p num_passes ] [ -t test_pattern ] device [ last_block ]
       [ first_block ]

๐Ÿ“– DESCRIPTION

badblocks is used to search for bad blocks on a device (usually a disk partition). device is the special file corresponding to the device (e.g /dev/hdc1). last_block is the last block to be checked; if it is not specified, the last block on the device is used as a default. first_block is an optional parameter specifying the starting block number for the test, which allows the testing to start in the middle of the disk. If it is not specified the first block on the disk is used as a default.

โš ๏ธ 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 file system. 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.

โš™๏ธ OPTIONS

โš ๏ธ WARNING

๐Ÿšซ Never use the -w option on a device containing an existing file system. This option erases data! If you want to do write-mode testing on an existing file system, use the -n option instead. It is slower, but it will preserve your data.

โš ๏ธ The -e option will cause badblocks to output a possibly incomplete list of bad blocks. Therefore it is recommended to use it only when one wants to know if there are any bad blocks at all on the device, and not when the list of bad blocks is wanted.

๐Ÿ‘ค AUTHOR

badblocks was written by Remy Card <Remy.Card AT linux.org>. Current maintainer is Theodore Ts'o <tytso AT alum.edu>. Non-destructive read/write test implemented by David Beattie <dbeattie AT softhome.net>.

๐Ÿ“ฆ AVAILABILITY

badblocks is part of the e2fsprogs package and is available from http://e2fsprogs.sourceforge.net.

๐Ÿ“š SEE ALSO

BADBLOCKS
๐Ÿ“› NAME ๐Ÿš€ Quick Reference ๐Ÿ“œ SYNOPSIS ๐Ÿ“– DESCRIPTION โš™๏ธ OPTIONS โš ๏ธ WARNING ๐Ÿ‘ค AUTHOR ๐Ÿ“ฆ AVAILABILITY ๐Ÿ“š SEE ALSO

Generated by phpman v4.9.26-5-g7740029 Author: Che Dong Under GNU General Public License
2026-08-14 20:46 @2600:1f28:365:80b0:4d23:66fa:c2bb:7bae
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!