blob: cbb9f4321f583a17469a42886bfda4d9ca96ae76 [file] [log] [blame]
Theodore Ts'o3839e651997-04-26 13:21:57 +00001.\" -*- nroff -*-
Theodore Ts'o74becf31997-04-26 14:37:06 +00002.TH BADBLOCKS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
Theodore Ts'o3839e651997-04-26 13:21:57 +00003.SH NAME
4badblocks \- search a device for bad blocks
5.SH SYNOPSIS
6.B badblocks
7[
Theodore Ts'o981dc562000-07-06 14:13:29 +00008.B \-svwnf
Theodore Ts'odd018f52000-02-06 23:57:07 +00009]
10[
Theodore Ts'o3839e651997-04-26 13:21:57 +000011.B \-b
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000012.I block-size
Theodore Ts'o3839e651997-04-26 13:21:57 +000013]
14[
Theodore Ts'odd018f52000-02-06 23:57:07 +000015.B \-c
16.I blocks_at_once
17]
18[
19.B \-i
20.I input_file
21]
22[
Theodore Ts'o3839e651997-04-26 13:21:57 +000023.B \-o
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000024.I output_file
Theodore Ts'o3839e651997-04-26 13:21:57 +000025]
26[
Theodore Ts'odd018f52000-02-06 23:57:07 +000027.B \-p
28.I num_passes
Theodore Ts'o3839e651997-04-26 13:21:57 +000029]
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000030.I device
Theodore Ts'o35964b52000-07-06 13:19:43 +000031[
Theodore Ts'ocd130a02001-05-05 05:43:23 +000032.I last-block
Theodore Ts'o35964b52000-07-06 13:19:43 +000033] [
34.I start-block
35]
Theodore Ts'o3839e651997-04-26 13:21:57 +000036.SH DESCRIPTION
37.B badblocks
38is used to search for bad blocks on a device (usually a disk partition).
Theodore Ts'o3839e651997-04-26 13:21:57 +000039.I device
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000040is the special file corresponding to the device (e.g
41.IR /dev/hdc1 ).
Theodore Ts'ocd130a02001-05-05 05:43:23 +000042.I last-block
43is the last block to be checked; if it is not specified, the last block
44on the device is used as a default.
45.I start-block
46is an optional parameter specifying the starting block number
47for the test, which allows the testing to start in the middle of the
48disk. If it is not specified the first block on the disk is used as a default.
Theodore Ts'o3839e651997-04-26 13:21:57 +000049.SH OPTIONS
50.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000051.BI \-b " block-size"
Theodore Ts'o3839e651997-04-26 13:21:57 +000052Specify the size of blocks in bytes.
53.TP
Theodore Ts'odd018f52000-02-06 23:57:07 +000054.BI \-c " number of blocks"
55is the number of blocks which are tested at a time. The default is 16.
Theodore Ts'o4d003982000-04-03 16:01:11 +000056Increasing this number will increase the efficiency of
57.B badblocks
58but also will increase its memory usage.
59.B Badblocks
60needs memory proportional to the number of blocks tested at once, in
61read-only mode, proportional to twice that number in read-write mode,
62and proportional to three times that number in non-destructive read-write
63mode. If you set the number-of-blocks parameter to too high a value,
64.B badblocks
65will exit almost immediately with an out-of-memory error "while allocating
66buffers". If you set it too low, however, for a non-destructive-write-mode
Theodore Ts'o7dc43502000-06-12 16:45:30 +000067test, then it's possble for questionable blocks on an unreliable
68hard drive to be hidden by the effects of the hard disk track buffer.
Theodore Ts'odd018f52000-02-06 23:57:07 +000069.TP
Theodore Ts'o981dc562000-07-06 14:13:29 +000070.B \-f
71Normally, badblocks will refuse to do a read/write or a non-destructive
72test on a device which is mounted, since this can cause the system to
73potentially crash. This can be overriden using the
74.B \-
75flag, but this should not be done under normal circumstances. The only time
76when this option might be safe is if the /etc/mtab file is incorrect, and
77the device really isn't mounted.
78.TP
Theodore Ts'odd018f52000-02-06 23:57:07 +000079.BI \-i " input_file"
Theodore Ts'o4d003982000-04-03 16:01:11 +000080Read a list of already existing known bad blocks.
81.B Badblocks
82will skip testing these blocks since they are known to be bad. If
83.I input_file
84is specified as "-", the list will be read from the standard input.
85Blocks listed in this list will be omitted from the list of
86.I new
87bad blocks produced on the standard output or in the output file.
88The
89.B \-b
90option of
91.BR dumpe2fs (8)
92can be used to retrieve the list of blocks currently marked bad on
93an existing filesystem, in a format suitable for use with this option.
Theodore Ts'odd018f52000-02-06 23:57:07 +000094.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000095.BI \-o " output_file"
Theodore Ts'odd018f52000-02-06 23:57:07 +000096Write the list of bad blocks to the specified file. Without this option,
Theodore Ts'o3839e651997-04-26 13:21:57 +000097.B badblocks
Theodore Ts'o92bcc591998-02-16 22:29:34 +000098displays the list on its standard output. The format of this file is suitable
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000099for use by the
Theodore Ts'odd018f52000-02-06 23:57:07 +0000100.
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000101.B \-l
102option in
Theodore Ts'o92bcc591998-02-16 22:29:34 +0000103.BR e2fsck (8)
104or
105.BR mke2fs (8).
Theodore Ts'o3839e651997-04-26 13:21:57 +0000106.TP
Theodore Ts'odd018f52000-02-06 23:57:07 +0000107.BI \-p " num_passes"
Theodore Ts'o4d003982000-04-03 16:01:11 +0000108Repeat scanning the disk until there are no new blocks discovered in
109num_passes consecutive scans of the disk.
110Default is 0, meaning
111.B badblocks
112will exit after the first pass.
Theodore Ts'odd018f52000-02-06 23:57:07 +0000113.TP
114.B \-n
Theodore Ts'oa551b782000-07-13 22:05:31 +0000115Use non-destructive read-write mode. By default only a non-destructive
116read-only test is done. This option must not be combined with the
117.B \-w
118option, as they are mutually exclusive.
Theodore Ts'odd018f52000-02-06 23:57:07 +0000119.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000120.B \-s
Theodore Ts'oca8abba1998-01-19 14:55:24 +0000121Show the progress of the scan by writing out the block numbers as they
122are checked.
123.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000124.B \-v
Theodore Ts'o3839e651997-04-26 13:21:57 +0000125Verbose mode.
126.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000127.B \-w
Theodore Ts'o3839e651997-04-26 13:21:57 +0000128Use write-mode test. With this option,
129.B badblocks
130scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on
Theodore Ts'oa551b782000-07-13 22:05:31 +0000131every block of the device, reading every block and comparing the contents.
132This option may not be compiled with the
133.B \-n
134option, as they are mutually exclusive.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000135.SH WARNING
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000136Never use the
137.B \-w
138option on an device containing an existing file system.
Theodore Ts'o4d003982000-04-03 16:01:11 +0000139This option erases data! If you want to do write-mode testing on
140an existing file system, use the
141.B \-n
Theodore Ts'oa551b782000-07-13 22:05:31 +0000142option instead. It is slower, but it will preserve your data.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000143.SH AUTHOR
144.B badblocks
Theodore Ts'offe4cab2000-04-03 13:27:41 +0000145was written by Remy Card <Remy.Card@linux.org>. Current maintainer is
146Theodore Ts'o <tytso@alum.mit.edu>. Non-destructive read/write test
Theodore Ts'o4d003982000-04-03 16:01:11 +0000147implemented by David Beattie <dbeattie@softhome.net>.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000148.SH AVAILABILITY
149.B badblocks
Theodore Ts'o12da49c2001-05-12 15:49:17 +0000150is part of the e2fsprogs package and is available from
Theodore Ts'o348e43d2001-05-03 14:43:43 +0000151http://e2fsprogs.sourceforge.net.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000152.SH SEE ALSO
153.BR e2fsck (8),
154.BR mke2fs (8)