|
Packit |
a62e42 |
.\" -*- nroff -*-
|
|
Packit |
a62e42 |
.TH BADBLOCKS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
|
|
Packit |
a62e42 |
.SH NAME
|
|
Packit |
a62e42 |
badblocks \- search a device for bad blocks
|
|
Packit |
a62e42 |
.SH SYNOPSIS
|
|
Packit |
a62e42 |
.B badblocks
|
|
Packit |
a62e42 |
[
|
|
Packit |
a62e42 |
.B \-svwnfBX
|
|
Packit |
a62e42 |
]
|
|
Packit |
a62e42 |
[
|
|
Packit |
a62e42 |
.B \-b
|
|
Packit |
a62e42 |
.I block_size
|
|
Packit |
a62e42 |
]
|
|
Packit |
a62e42 |
[
|
|
Packit |
a62e42 |
.B \-c
|
|
Packit |
a62e42 |
.I blocks_at_once
|
|
Packit |
a62e42 |
]
|
|
Packit |
a62e42 |
[
|
|
Packit |
a62e42 |
.B \-d
|
|
Packit |
a62e42 |
.I read_delay_factor
|
|
Packit |
a62e42 |
]
|
|
Packit |
a62e42 |
[
|
|
Packit |
a62e42 |
.B \-e
|
|
Packit |
a62e42 |
.I max_bad_blocks
|
|
Packit |
a62e42 |
]
|
|
Packit |
a62e42 |
[
|
|
Packit |
a62e42 |
.B \-i
|
|
Packit |
a62e42 |
.I input_file
|
|
Packit |
a62e42 |
]
|
|
Packit |
a62e42 |
[
|
|
Packit |
a62e42 |
.B \-o
|
|
Packit |
a62e42 |
.I output_file
|
|
Packit |
a62e42 |
]
|
|
Packit |
a62e42 |
[
|
|
Packit |
a62e42 |
.B \-p
|
|
Packit |
a62e42 |
.I num_passes
|
|
Packit |
a62e42 |
]
|
|
Packit |
a62e42 |
[
|
|
Packit |
a62e42 |
.B \-t
|
|
Packit |
a62e42 |
.I test_pattern
|
|
Packit |
a62e42 |
]
|
|
Packit |
a62e42 |
.I device
|
|
Packit |
a62e42 |
[
|
|
Packit |
a62e42 |
.I last_block
|
|
Packit |
a62e42 |
] [
|
|
Packit |
a62e42 |
.I first_block
|
|
Packit |
a62e42 |
]
|
|
Packit |
a62e42 |
.SH DESCRIPTION
|
|
Packit |
a62e42 |
.B badblocks
|
|
Packit |
a62e42 |
is used to search for bad blocks on a device (usually a disk partition).
|
|
Packit |
a62e42 |
.I device
|
|
Packit |
a62e42 |
is the special file corresponding to the device (e.g
|
|
Packit |
a62e42 |
.IR /dev/hdc1 ).
|
|
Packit |
a62e42 |
.I last_block
|
|
Packit |
a62e42 |
is the last block to be checked; if it is not specified, the last block
|
|
Packit |
a62e42 |
on the device is used as a default.
|
|
Packit |
a62e42 |
.I first_block
|
|
Packit |
a62e42 |
is an optional parameter specifying the starting block number
|
|
Packit |
a62e42 |
for the test, which allows the testing to start in the middle of the
|
|
Packit |
a62e42 |
disk. If it is not specified the first block on the disk is used as a default.
|
|
Packit |
a62e42 |
.PP
|
|
Packit |
a62e42 |
.B Important note:
|
|
Packit |
a62e42 |
If the output of
|
|
Packit |
a62e42 |
.B badblocks
|
|
Packit |
a62e42 |
is going to be fed to the
|
|
Packit |
a62e42 |
.B e2fsck
|
|
Packit |
a62e42 |
or
|
|
Packit |
a62e42 |
.B mke2fs
|
|
Packit |
a62e42 |
programs, it is important that the block size is properly specified,
|
|
Packit |
a62e42 |
since the block numbers which are generated are very dependent on the
|
|
Packit |
a62e42 |
block size in use by the filesystem.
|
|
Packit |
a62e42 |
For this reason, it is strongly recommended that
|
|
Packit |
a62e42 |
users
|
|
Packit |
a62e42 |
.B not
|
|
Packit |
a62e42 |
run
|
|
Packit |
a62e42 |
.B badblocks
|
|
Packit |
a62e42 |
directly, but rather use the
|
|
Packit |
a62e42 |
.B \-c
|
|
Packit |
a62e42 |
option of the
|
|
Packit |
a62e42 |
.B e2fsck
|
|
Packit |
a62e42 |
and
|
|
Packit |
a62e42 |
.B mke2fs
|
|
Packit |
a62e42 |
programs.
|
|
Packit |
a62e42 |
.SH OPTIONS
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.BI \-b " block_size"
|
|
Packit |
a62e42 |
Specify the size of blocks in bytes. The default is 1024.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.BI \-c " number of blocks"
|
|
Packit |
a62e42 |
is the number of blocks which are tested at a time. The default is 64.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.BI \-d " read delay factor"
|
|
Packit |
a62e42 |
This parameter, if passed and non-zero, will cause bad blocks to sleep
|
|
Packit |
a62e42 |
between reads if there were no errors encountered in the read
|
|
Packit |
a62e42 |
operation; the delay will be calculated as a percentage of the time it
|
|
Packit |
a62e42 |
took for the read operation to be performed. In other words, a value of
|
|
Packit |
a62e42 |
100 will cause each read to be delayed by the amount the previous read
|
|
Packit |
a62e42 |
took, and a value of 200 by twice the amount.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.BI \-e " max bad block count"
|
|
Packit |
a62e42 |
Specify a maximum number of bad blocks before aborting the test. The
|
|
Packit |
a62e42 |
default is 0, meaning the test will continue until the end of the test
|
|
Packit |
a62e42 |
range is reached.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.B \-f
|
|
Packit |
a62e42 |
Normally, badblocks will refuse to do a read/write or a non-destructive
|
|
Packit |
a62e42 |
test on a device which is mounted, since either can cause the system to
|
|
Packit |
a62e42 |
potentially crash and/or damage the filesystem even if it is mounted
|
|
Packit |
a62e42 |
read-only. This can be overridden using the
|
|
Packit |
a62e42 |
.B \-f
|
|
Packit |
a62e42 |
flag, but should almost never be used --- if you think you're smarter
|
|
Packit |
a62e42 |
than the
|
|
Packit |
a62e42 |
.B badblocks
|
|
Packit |
a62e42 |
program, you almost certainly aren't. The only time when this option
|
|
Packit |
a62e42 |
might be safe to use is if the /etc/mtab file is incorrect, and the device
|
|
Packit |
a62e42 |
really isn't mounted.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.BI \-i " input_file"
|
|
Packit |
a62e42 |
Read a list of already existing known bad blocks.
|
|
Packit |
a62e42 |
.B Badblocks
|
|
Packit |
a62e42 |
will skip testing these blocks since they are known to be bad. If
|
|
Packit |
a62e42 |
.I input_file
|
|
Packit |
a62e42 |
is specified as "-", the list will be read from the standard input.
|
|
Packit |
a62e42 |
Blocks listed in this list will be omitted from the list of
|
|
Packit |
a62e42 |
.I new
|
|
Packit |
a62e42 |
bad blocks produced on the standard output or in the output file.
|
|
Packit |
a62e42 |
The
|
|
Packit |
a62e42 |
.B \-b
|
|
Packit |
a62e42 |
option of
|
|
Packit |
a62e42 |
.BR dumpe2fs (8)
|
|
Packit |
a62e42 |
can be used to retrieve the list of blocks currently marked bad on
|
|
Packit |
a62e42 |
an existing filesystem, in a format suitable for use with this option.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.B \-n
|
|
Packit |
a62e42 |
Use non-destructive read-write mode. By default only a non-destructive
|
|
Packit |
a62e42 |
read-only test is done. This option must not be combined with the
|
|
Packit |
a62e42 |
.B \-w
|
|
Packit |
a62e42 |
option, as they are mutually exclusive.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.BI \-o " output_file"
|
|
Packit |
a62e42 |
Write the list of bad blocks to the specified file. Without this option,
|
|
Packit |
a62e42 |
.B badblocks
|
|
Packit |
a62e42 |
displays the list on its standard output. The format of this file is suitable
|
|
Packit |
a62e42 |
for use by the
|
|
Packit |
a62e42 |
.
|
|
Packit |
a62e42 |
.B \-l
|
|
Packit |
a62e42 |
option in
|
|
Packit |
a62e42 |
.BR e2fsck (8)
|
|
Packit |
a62e42 |
or
|
|
Packit |
a62e42 |
.BR mke2fs (8).
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.BI \-p " num_passes"
|
|
Packit |
a62e42 |
Repeat scanning the disk until there are no new blocks discovered in
|
|
Packit |
a62e42 |
num_passes consecutive scans of the disk.
|
|
Packit |
a62e42 |
Default is 0, meaning
|
|
Packit |
a62e42 |
.B badblocks
|
|
Packit |
a62e42 |
will exit after the first pass.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.B \-s
|
|
Packit |
a62e42 |
Show the progress of the scan by writing out rough percentage completion
|
|
Packit |
a62e42 |
of the current badblocks pass over the disk. Note that badblocks may do
|
|
Packit |
a62e42 |
multiple test passes over the disk, in particular if the
|
|
Packit |
a62e42 |
.B \-p
|
|
Packit |
a62e42 |
or
|
|
Packit |
a62e42 |
.B \-w
|
|
Packit |
a62e42 |
option is requested by the user.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.BI \-t " test_pattern"
|
|
Packit |
a62e42 |
Specify a test pattern to be read (and written) to disk blocks. The
|
|
Packit |
a62e42 |
.I test_pattern
|
|
Packit |
a62e42 |
may either be a numeric value between 0 and ULONG_MAX-1 inclusive, or the word
|
|
Packit |
a62e42 |
"random", which specifies that the block should be filled with a random
|
|
Packit |
a62e42 |
bit pattern.
|
|
Packit |
a62e42 |
For read/write (\fB-w\fR) and non-destructive (\fB-n\fR) modes,
|
|
Packit |
a62e42 |
one or more test patterns may be specified by specifying the
|
|
Packit |
a62e42 |
.B -t
|
|
Packit |
a62e42 |
option for each test pattern desired. For
|
|
Packit |
a62e42 |
read-only mode only a single pattern may be specified and it may not be
|
|
Packit |
a62e42 |
"random". Read-only testing with a pattern assumes that the
|
|
Packit |
a62e42 |
specified pattern has previously been written to the disk - if not, large
|
|
Packit |
a62e42 |
numbers of blocks will fail verification.
|
|
Packit |
a62e42 |
If multiple patterns
|
|
Packit |
a62e42 |
are specified then all blocks will be tested with one pattern
|
|
Packit |
a62e42 |
before proceeding to the next pattern.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.B \-v
|
|
Packit |
a62e42 |
Verbose mode. Will write the number of read errors, write errors and data-
|
|
Packit |
a62e42 |
corruptions to stderr.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.B \-w
|
|
Packit |
a62e42 |
Use write-mode test. With this option,
|
|
Packit |
a62e42 |
.B badblocks
|
|
Packit |
a62e42 |
scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on
|
|
Packit |
a62e42 |
every block of the device, reading every block and comparing the contents.
|
|
Packit |
a62e42 |
This option may not be combined with the
|
|
Packit |
a62e42 |
.B \-n
|
|
Packit |
a62e42 |
option, as they are mutually exclusive.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.B \-B
|
|
Packit |
a62e42 |
Use buffered I/O and do not use Direct I/O, even if it is available.
|
|
Packit |
a62e42 |
.TP
|
|
Packit |
a62e42 |
.B \-X
|
|
Packit |
a62e42 |
Internal flag only to be used by
|
|
Packit |
a62e42 |
.BR e2fsck (8)
|
|
Packit |
a62e42 |
and
|
|
Packit |
a62e42 |
.BR mke2fs (8).
|
|
Packit |
a62e42 |
It bypasses the exclusive mode in-use device safety check.
|
|
Packit |
a62e42 |
.SH WARNING
|
|
Packit |
a62e42 |
Never use the
|
|
Packit |
a62e42 |
.B \-w
|
|
Packit |
a62e42 |
option on a device containing an existing file system.
|
|
Packit |
a62e42 |
This option erases data! If you want to do write-mode testing on
|
|
Packit |
a62e42 |
an existing file system, use the
|
|
Packit |
a62e42 |
.B \-n
|
|
Packit |
a62e42 |
option instead. It is slower, but it will preserve your data.
|
|
Packit |
a62e42 |
.PP
|
|
Packit |
a62e42 |
The
|
|
Packit |
a62e42 |
.B \-e
|
|
Packit |
a62e42 |
option will cause badblocks to output a possibly incomplete list of
|
|
Packit |
a62e42 |
bad blocks. Therefore it is recommended to use it only when one wants
|
|
Packit |
a62e42 |
to know if there are any bad blocks at all on the device, and not when
|
|
Packit |
a62e42 |
the list of bad blocks is wanted.
|
|
Packit |
a62e42 |
.SH AUTHOR
|
|
Packit |
a62e42 |
.B badblocks
|
|
Packit |
a62e42 |
was written by Remy Card <Remy.Card@linux.org>. Current maintainer is
|
|
Packit |
a62e42 |
Theodore Ts'o <tytso@alum.mit.edu>. Non-destructive read/write test
|
|
Packit |
a62e42 |
implemented by David Beattie <dbeattie@softhome.net>.
|
|
Packit |
a62e42 |
.SH AVAILABILITY
|
|
Packit |
a62e42 |
.B badblocks
|
|
Packit |
a62e42 |
is part of the e2fsprogs package and is available from
|
|
Packit |
a62e42 |
http://e2fsprogs.sourceforge.net.
|
|
Packit |
a62e42 |
.SH SEE ALSO
|
|
Packit |
a62e42 |
.BR e2fsck (8),
|
|
Packit |
a62e42 |
.BR mke2fs (8)
|