Whamcloud - gitweb
ChangeLog:
[tools/e2fsprogs.git] / misc / badblocks.8.in
1 .\" -*- nroff -*-
2 .TH BADBLOCKS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
3 .SH NAME
4 badblocks \- search a device for bad blocks
5 .SH SYNOPSIS
6 .B badblocks
7 [
8 .B \-svwnf
9 ]
10 [
11 .B \-b
12 .I block-size
13 ]
14 [
15 .B \-c
16 .I blocks_at_once
17 ]
18 [
19 .B \-i
20 .I input_file
21 ]
22 [
23 .B \-o
24 .I output_file
25 ]
26 [
27 .B \-p
28 .I num_passes
29 ]
30 .I device
31 [
32 .I last-block
33 ] [
34 .I start-block 
35 ]
36 .SH DESCRIPTION
37 .B badblocks
38 is used to search for bad blocks on a device (usually a disk partition).
39 .I device
40 is the special file corresponding to the device (e.g
41 .IR /dev/hdc1 ).
42 .I last-block
43 is the last block to be checked; if it is not specified, the last block
44 on the device is used as a default.
45 .I start-block
46 is an optional parameter specifying the starting block number
47 for the test, which allows the testing to start in the middle of the
48 disk.  If it is not specified the first block on the disk is used as a default.
49 .SH OPTIONS
50 .TP
51 .BI \-b " block-size"
52 Specify the size of blocks in bytes.
53 .TP
54 .BI \-c " number of blocks"
55 is the number of blocks which are tested at a time.  The default is 16.
56 Increasing this number will increase the efficiency of
57 .B badblocks
58 but also will increase its memory usage.
59 .B Badblocks
60 needs memory proportional to the number of blocks tested at once, in
61 read-only mode, proportional to twice that number in read-write mode,
62 and proportional to three times that number in non-destructive read-write
63 mode.  If you set the number-of-blocks parameter to too high a value,
64 .B badblocks
65 will exit almost immediately with an out-of-memory error "while allocating
66 buffers".  If you set it too low, however, for a non-destructive-write-mode
67 test, then it's possble for questionable blocks on an unreliable
68 hard drive to be hidden by the effects of the hard disk track buffer.
69 .TP
70 .B \-f
71 Normally, badblocks will refuse to do a read/write or a non-destructive
72 test on a device which is mounted, since this can cause the system to 
73 potentially crash.  This can be overriden using the
74 .B \-
75 flag, but this should not be done under normal circumstances.  The only time
76 when this option might be safe is if the /etc/mtab file is incorrect, and
77 the device really isn't mounted.
78 .TP
79 .BI \-i " input_file"
80 Read a list of already existing known bad blocks.
81 .B Badblocks
82 will skip testing these blocks since they are known to be bad.  If
83 .I input_file
84 is specified as "-", the list will be read from the standard input.
85 Blocks listed in this list will be omitted from the list of
86 .I new
87 bad blocks produced on the standard output or in the output file.
88 The
89 .B \-b
90 option of
91 .BR dumpe2fs (8)
92 can be used to retrieve the list of blocks currently marked bad on
93 an existing filesystem, in a format suitable for use with this option.
94 .TP
95 .BI \-o " output_file"
96 Write the list of bad blocks to the specified file.  Without this option,
97 .B badblocks
98 displays the list on its standard output.  The format of this file is suitable
99 for use by the
100 .
101 .B \-l
102 option in 
103 .BR e2fsck (8)
104 or
105 .BR mke2fs (8).
106 .TP
107 .BI \-p " num_passes"
108 Repeat scanning the disk until there are no new blocks discovered in
109 num_passes consecutive scans of the disk.
110 Default is 0, meaning
111 .B badblocks
112 will exit after the first pass.
113 .TP
114 .B \-n
115 Use non-destructive read-write mode.  By default only a non-destructive 
116 read-only test is done.  This option must not be combined with the 
117 .B \-w
118 option, as they are mutually exclusive.
119 .TP
120 .B \-s
121 Show the progress of the scan by writing out the block numbers as they
122 are checked.
123 .TP
124 .B \-v
125 Verbose mode.
126 .TP
127 .B \-w
128 Use write-mode test. With this option,
129 .B badblocks
130 scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on
131 every block of the device, reading every block and comparing the contents.  
132 This option may not be compiled with the 
133 .B \-n 
134 option, as they are mutually exclusive.
135 .SH WARNING
136 Never use the
137 .B \-w
138 option on an device containing an existing file system.
139 This option erases data!  If you want to do write-mode testing on
140 an existing file system, use the
141 .B \-n
142 option instead.  It is slower, but it will preserve your data.  
143 .SH AUTHOR
144 .B badblocks
145 was written by Remy Card <Remy.Card@linux.org>.  Current maintainer is
146 Theodore Ts'o <tytso@alum.mit.edu>.  Non-destructive read/write test
147 implemented by David Beattie <dbeattie@softhome.net>.
148 .SH AVAILABILITY
149 .B badblocks
150 is part of the e2fsprogs package and is available from 
151 http://e2fsprogs.sourceforge.net.
152 .SH SEE ALSO
153 .BR e2fsck (8),
154 .BR mke2fs (8)