359 lines
8.5 KiB
HTML
359 lines
8.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of BADBLOCKS</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>BADBLOCKS</H1>
|
|
Section: Maintenance Commands (8)<BR>Updated: January 2020<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
badblocks - search a device for bad blocks
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>badblocks</B>
|
|
|
|
[
|
|
<B>-svwnfBX</B>
|
|
|
|
]
|
|
[
|
|
<B>-b</B>
|
|
|
|
<I>block_size</I>
|
|
|
|
]
|
|
[
|
|
<B>-c</B>
|
|
|
|
<I>blocks_at_once</I>
|
|
|
|
]
|
|
[
|
|
<B>-d</B>
|
|
|
|
<I>read_delay_factor</I>
|
|
|
|
]
|
|
[
|
|
<B>-e</B>
|
|
|
|
<I>max_bad_blocks</I>
|
|
|
|
]
|
|
[
|
|
<B>-i</B>
|
|
|
|
<I>input_file</I>
|
|
|
|
]
|
|
[
|
|
<B>-o</B>
|
|
|
|
<I>output_file</I>
|
|
|
|
]
|
|
[
|
|
<B>-p</B>
|
|
|
|
<I>num_passes</I>
|
|
|
|
]
|
|
[
|
|
<B>-t</B>
|
|
|
|
<I>test_pattern</I>
|
|
|
|
]
|
|
<I>device</I>
|
|
|
|
[
|
|
<I>last_block</I>
|
|
|
|
] [
|
|
<I>first_block</I>
|
|
|
|
]
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>badblocks</B>
|
|
|
|
is used to search for bad blocks on a device (usually a disk partition).
|
|
<I>device</I>
|
|
|
|
is the special file corresponding to the device (e.g
|
|
<I>/dev/hdc1</I>).
|
|
|
|
<I>last_block</I>
|
|
|
|
is the last block to be checked; if it is not specified, the last block
|
|
on the device is used as a default.
|
|
<I>first_block</I>
|
|
|
|
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.
|
|
<P>
|
|
|
|
<B>Important note:</B>
|
|
|
|
If the output of
|
|
<B>badblocks</B>
|
|
|
|
is going to be fed to the
|
|
<B>e2fsck</B>
|
|
|
|
or
|
|
<B>mke2fs</B>
|
|
|
|
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
|
|
<B>not</B>
|
|
|
|
run
|
|
<B>badblocks</B>
|
|
|
|
directly, but rather use the
|
|
<B>-c</B>
|
|
|
|
option of the
|
|
<B>e2fsck</B>
|
|
|
|
and
|
|
<B>mke2fs</B>
|
|
|
|
programs.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-b</B><I> block_size</I>
|
|
|
|
<DD>
|
|
Specify the size of blocks in bytes. The default is 1024.
|
|
<DT id="2"><B>-c</B><I> number of blocks</I>
|
|
|
|
<DD>
|
|
is the number of blocks which are tested at a time. The default is 64.
|
|
<DT id="3"><B>-d</B><I> read delay factor</I>
|
|
|
|
<DD>
|
|
This parameter, if passed and non-zero, will cause bad blocks to sleep
|
|
between reads if there were no errors encountered in the read
|
|
operation; the delay will be calculated as a percentage of the time it
|
|
took for the read operation to be performed. In other words, a value of
|
|
100 will cause each read to be delayed by the amount the previous read
|
|
took, and a value of 200 by twice the amount.
|
|
<DT id="4"><B>-e</B><I> max bad block count</I>
|
|
|
|
<DD>
|
|
Specify a maximum number of bad blocks before aborting the test. The
|
|
default is 0, meaning the test will continue until the end of the test
|
|
range is reached.
|
|
<DT id="5"><B>-f</B>
|
|
|
|
<DD>
|
|
Normally, badblocks will refuse to do a read/write or a non-destructive
|
|
test on a device which is mounted, since either can cause the system to
|
|
potentially crash and/or damage the filesystem even if it is mounted
|
|
read-only. This can be overridden using the
|
|
<B>-f</B>
|
|
|
|
flag, but should almost never be used --- if you think you're smarter
|
|
than the
|
|
<B>badblocks</B>
|
|
|
|
program, you almost certainly aren't. The only time when this option
|
|
might be safe to use is if the /etc/mtab file is incorrect, and the device
|
|
really isn't mounted.
|
|
<DT id="6"><B>-i</B><I> input_file</I>
|
|
|
|
<DD>
|
|
Read a list of already existing known bad blocks.
|
|
<B>Badblocks</B>
|
|
|
|
will skip testing these blocks since they are known to be bad. If
|
|
<I>input_file</I>
|
|
|
|
is specified as "-", the list will be read from the standard input.
|
|
Blocks listed in this list will be omitted from the list of
|
|
<I>new</I>
|
|
|
|
bad blocks produced on the standard output or in the output file.
|
|
The
|
|
<B>-b</B>
|
|
|
|
option of
|
|
<B><A HREF="/cgi-bin/man/man2html?8+dumpe2fs">dumpe2fs</A></B>(8)
|
|
|
|
can be used to retrieve the list of blocks currently marked bad on
|
|
an existing filesystem, in a format suitable for use with this option.
|
|
<DT id="7"><B>-n</B>
|
|
|
|
<DD>
|
|
Use non-destructive read-write mode. By default only a non-destructive
|
|
read-only test is done. This option must not be combined with the
|
|
<B>-w</B>
|
|
|
|
option, as they are mutually exclusive.
|
|
<DT id="8"><B>-o</B><I> output_file</I>
|
|
|
|
<DD>
|
|
Write the list of bad blocks to the specified file. Without this option,
|
|
<B>badblocks</B>
|
|
|
|
displays the list on its standard output. The format of this file is suitable
|
|
for use by the
|
|
<B>-l</B>
|
|
|
|
option in
|
|
<B><A HREF="/cgi-bin/man/man2html?8+e2fsck">e2fsck</A></B>(8)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?8+mke2fs">mke2fs</A></B>(8).
|
|
|
|
<DT id="9"><B>-p</B><I> num_passes</I>
|
|
|
|
<DD>
|
|
Repeat scanning the disk until there are no new blocks discovered in
|
|
num_passes consecutive scans of the disk.
|
|
Default is 0, meaning
|
|
<B>badblocks</B>
|
|
|
|
will exit after the first pass.
|
|
<DT id="10"><B>-s</B>
|
|
|
|
<DD>
|
|
Show the progress of the scan by writing out rough percentage completion
|
|
of the current badblocks pass over the disk. Note that badblocks may do
|
|
multiple test passes over the disk, in particular if the
|
|
<B>-p</B>
|
|
|
|
or
|
|
<B>-w</B>
|
|
|
|
option is requested by the user.
|
|
<DT id="11"><B>-t</B><I> test_pattern</I>
|
|
|
|
<DD>
|
|
Specify a test pattern to be read (and written) to disk blocks. The
|
|
<I>test_pattern</I>
|
|
|
|
may either be a numeric value between 0 and ULONG_MAX-1 inclusive, or the word
|
|
"random", which specifies that the block should be filled with a random
|
|
bit pattern.
|
|
For read/write (<B>-w</B>) and non-destructive (<B>-n</B>) modes,
|
|
one or more test patterns may be specified by specifying the
|
|
<B>-t</B>
|
|
|
|
option for each test pattern desired. For
|
|
read-only mode only a single pattern may be specified and it may not be
|
|
"random". Read-only testing with a pattern assumes that the
|
|
specified pattern has previously been written to the disk - if not, large
|
|
numbers of blocks will fail verification.
|
|
If multiple patterns
|
|
are specified then all blocks will be tested with one pattern
|
|
before proceeding to the next pattern.
|
|
<DT id="12"><B>-v</B>
|
|
|
|
<DD>
|
|
Verbose mode. Will write the number of read errors, write errors and data-
|
|
corruptions to stderr.
|
|
<DT id="13"><B>-w</B>
|
|
|
|
<DD>
|
|
Use write-mode test. With this option,
|
|
<B>badblocks</B>
|
|
|
|
scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on
|
|
every block of the device, reading every block and comparing the contents.
|
|
This option may not be combined with the
|
|
<B>-n</B>
|
|
|
|
option, as they are mutually exclusive.
|
|
<DT id="14"><B>-B</B>
|
|
|
|
<DD>
|
|
Use buffered I/O and do not use Direct I/O, even if it is available.
|
|
<DT id="15"><B>-X</B>
|
|
|
|
<DD>
|
|
Internal flag only to be used by
|
|
<B><A HREF="/cgi-bin/man/man2html?8+e2fsck">e2fsck</A></B>(8)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?8+mke2fs">mke2fs</A></B>(8).
|
|
|
|
It bypasses the exclusive mode in-use device safety check.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>WARNING</H2>
|
|
|
|
Never use the
|
|
<B>-w</B>
|
|
|
|
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
|
|
<B>-n</B>
|
|
|
|
option instead. It is slower, but it will preserve your data.
|
|
<P>
|
|
|
|
The
|
|
<B>-e</B>
|
|
|
|
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.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
<B>badblocks</B>
|
|
|
|
was written by Remy Card <<A HREF="mailto:Remy.Card@linux.org">Remy.Card@linux.org</A>>. Current maintainer is
|
|
Theodore Ts'o <<A HREF="mailto:tytso@alum.mit.edu">tytso@alum.mit.edu</A>>. Non-destructive read/write test
|
|
implemented by David Beattie <<A HREF="mailto:dbeattie@softhome.net">dbeattie@softhome.net</A>>.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>AVAILABILITY</H2>
|
|
|
|
<B>badblocks</B>
|
|
|
|
is part of the e2fsprogs package and is available from
|
|
<A HREF="http://e2fsprogs.sourceforge.net.">http://e2fsprogs.sourceforge.net.</A>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+e2fsck">e2fsck</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+mke2fs">mke2fs</A></B>(8)
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="16"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="17"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="18"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="19"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="20"><A HREF="#lbAF">WARNING</A><DD>
|
|
<DT id="21"><A HREF="#lbAG">AUTHOR</A><DD>
|
|
<DT id="22"><A HREF="#lbAH">AVAILABILITY</A><DD>
|
|
<DT id="23"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:11 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|