2 .TH BADBLOCKS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
4 badblocks \- search a device for bad blocks
50 is used to search for bad blocks on a device (usually a disk partition).
52 is the special file corresponding to the device (e.g
55 is the last block to be checked; if it is not specified, the last block
56 on the device is used as a default.
58 is an optional parameter specifying the starting block number
59 for the test, which allows the testing to start in the middle of the
60 disk. If it is not specified the first block on the disk is used as a default.
65 is going to be fed to the
69 programs, it is important that the block size is properly specified,
70 since the block numbers which are generated are very dependent on the
71 block size in use by the filesystem.
72 For this reason, it is strongly recommended that
77 directly, but rather use the
87 Specify the size of blocks in bytes. The default is 1024.
89 .BI \-c " number of blocks"
90 is the number of blocks which are tested at a time. The default is 64.
92 .BI \-d " read delay factor"
93 This parameter, if passed and non-zero, will cause bad blocks to sleep
94 between reads if there were no errors encountered in the read
95 operation; the delay will be calculated as a percentage of the time it
96 took for the read operation to be performed. In other words, a value of
97 100 will cause each read to be delayed by the amount the previous read
98 took, and a value of 200 by twice the amount.
100 .BI \-e " max bad block count"
101 Specify a maximum number of bad blocks before aborting the test. The
102 default is 0, meaning the test will continue until the end of the test
106 Normally, badblocks will refuse to do a read/write or a non-destructive
107 test on a device which is mounted, since either can cause the system to
108 potentially crash and/or damage the filesystem even if it is mounted
109 read-only. This can be overridden using the
111 flag, but should almost never be used --- if you think you're smarter
114 program, you almost certainly aren't. The only time when this option
115 might be safe to use is if the /etc/mtab file is incorrect, and the device
116 really isn't mounted.
118 .BI \-i " input_file"
119 Read a list of already existing known bad blocks.
121 will skip testing these blocks since they are known to be bad. If
123 is specified as "-", the list will be read from the standard input.
124 Blocks listed in this list will be omitted from the list of
126 bad blocks produced on the standard output or in the output file.
131 can be used to retrieve the list of blocks currently marked bad on
132 an existing filesystem, in a format suitable for use with this option.
135 Use non-destructive read-write mode. By default only a non-destructive
136 read-only test is done. This option must not be combined with the
138 option, as they are mutually exclusive.
140 .BI \-o " output_file"
141 Write the list of bad blocks to the specified file. Without this option,
143 displays the list on its standard output. The format of this file is suitable
152 .BI \-p " num_passes"
153 Repeat scanning the disk until there are no new blocks discovered in
154 num_passes consecutive scans of the disk.
155 Default is 0, meaning
157 will exit after the first pass.
160 Show the progress of the scan by writing out rough percentage completion
161 of the current badblocks pass over the disk. Note that badblocks may do
162 multiple test passes over the disk, in particular if the
166 option is requested by the user.
168 .BI \-t " test_pattern"
169 Specify a test pattern to be read (and written) to disk blocks. The
171 may either be a numeric value between 0 and ULONG_MAX-1 inclusive, or the word
172 "random", which specifies that the block should be filled with a random
174 For read/write (\fB-w\fR) and non-destructive (\fB-n\fR) modes,
175 one or more test patterns may be specified by specifying the
177 option for each test pattern desired. For
178 read-only mode only a single pattern may be specified and it may not be
179 "random". Read-only testing with a pattern assumes that the
180 specified pattern has previously been written to the disk - if not, large
181 numbers of blocks will fail verification.
183 are specified then all blocks will be tested with one pattern
184 before proceeding to the next pattern.
187 Verbose mode. Will write the number of read errors, write errors and data-
188 corruptions to stderr.
191 Use write-mode test. With this option,
193 scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on
194 every block of the device, reading every block and comparing the contents.
195 This option may not be combined with the
197 option, as they are mutually exclusive.
200 Use buffered I/O and do not use Direct I/O, even if it is available.
203 Internal flag only to be used by
207 It bypasses the exclusive mode in-use device safety check.
211 option on a device containing an existing file system.
212 This option erases data! If you want to do write-mode testing on
213 an existing file system, use the
215 option instead. It is slower, but it will preserve your data.
219 option will cause badblocks to output a possibly incomplete list of
220 bad blocks. Therefore it is recommended to use it only when one wants
221 to know if there are any bad blocks at all on the device, and not when
222 the list of bad blocks is wanted.
225 was written by Remy Card <Remy.Card@linux.org>. Current maintainer is
226 Theodore Ts'o <tytso@alum.mit.edu>. Non-destructive read/write test
227 implemented by David Beattie <dbeattie@softhome.net>.
230 is part of the e2fsprogs package and is available from
231 http://e2fsprogs.sourceforge.net.