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