Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 1 | .\" -*- nroff -*- |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 2 | .TH BADBLOCKS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 3 | .SH NAME |
| 4 | badblocks \- search a device for bad blocks |
| 5 | .SH SYNOPSIS |
| 6 | .B badblocks |
| 7 | [ |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 8 | .B \-svwnfBX |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 9 | ] |
| 10 | [ |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 11 | .B \-b |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 12 | .I block-size |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 13 | ] |
| 14 | [ |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 15 | .B \-c |
| 16 | .I blocks_at_once |
| 17 | ] |
| 18 | [ |
Iustin Pop | 931b028 | 2008-06-11 13:12:17 +0200 | [diff] [blame] | 19 | .B \-e |
| 20 | .I max_bad_blocks |
| 21 | ] |
| 22 | [ |
Iustin Pop | 264f64a | 2008-06-12 09:30:04 +0200 | [diff] [blame] | 23 | .B \-d |
| 24 | .I read_delay_factor |
| 25 | ] |
| 26 | [ |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 27 | .B \-i |
| 28 | .I input_file |
| 29 | ] |
| 30 | [ |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 31 | .B \-o |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 32 | .I output_file |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 33 | ] |
| 34 | [ |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 35 | .B \-p |
| 36 | .I num_passes |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 37 | ] |
Theodore Ts'o | 849b6bc | 2003-05-07 09:52:14 -0400 | [diff] [blame] | 38 | [ |
| 39 | .B \-t |
| 40 | .I test_pattern |
| 41 | ] |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 42 | .I device |
Theodore Ts'o | 35964b5 | 2000-07-06 13:19:43 +0000 | [diff] [blame] | 43 | [ |
Theodore Ts'o | cd130a0 | 2001-05-05 05:43:23 +0000 | [diff] [blame] | 44 | .I last-block |
Theodore Ts'o | 35964b5 | 2000-07-06 13:19:43 +0000 | [diff] [blame] | 45 | ] [ |
Theodore Ts'o | f56f32b | 2008-07-10 10:08:40 -0400 | [diff] [blame] | 46 | .I first-block |
Theodore Ts'o | 35964b5 | 2000-07-06 13:19:43 +0000 | [diff] [blame] | 47 | ] |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 48 | .SH DESCRIPTION |
| 49 | .B badblocks |
| 50 | is used to search for bad blocks on a device (usually a disk partition). |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 51 | .I device |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 52 | is the special file corresponding to the device (e.g |
| 53 | .IR /dev/hdc1 ). |
Theodore Ts'o | cd130a0 | 2001-05-05 05:43:23 +0000 | [diff] [blame] | 54 | .I last-block |
| 55 | is the last block to be checked; if it is not specified, the last block |
| 56 | on the device is used as a default. |
Theodore Ts'o | f56f32b | 2008-07-10 10:08:40 -0400 | [diff] [blame] | 57 | .I first-block |
Theodore Ts'o | cd130a0 | 2001-05-05 05:43:23 +0000 | [diff] [blame] | 58 | is an optional parameter specifying the starting block number |
| 59 | for the test, which allows the testing to start in the middle of the |
| 60 | disk. If it is not specified the first block on the disk is used as a default. |
Theodore Ts'o | 3ed57c2 | 2001-12-24 15:01:59 -0500 | [diff] [blame] | 61 | .PP |
| 62 | .B Important note: |
| 63 | If the output of |
| 64 | .B badblocks |
| 65 | is going to be fed to the |
| 66 | .B e2fsck |
| 67 | or |
| 68 | .B mke2fs |
| 69 | programs, it is important that the block size is properly specified, |
Theodore Ts'o | 19445ef | 2003-01-29 21:04:52 -0500 | [diff] [blame] | 70 | since the block numbers which are generated are very dependent on the |
Theodore Ts'o | df95e09 | 2004-09-28 10:30:27 -0400 | [diff] [blame] | 71 | block size in use by the filesystem. |
| 72 | For this reason, it is strongly recommended that |
Theodore Ts'o | 3ed57c2 | 2001-12-24 15:01:59 -0500 | [diff] [blame] | 73 | users |
| 74 | .B not |
| 75 | run |
| 76 | .B badblocks |
| 77 | directly, but rather use the |
| 78 | .B \-c |
| 79 | option of the |
| 80 | .B e2fsck |
| 81 | and |
| 82 | .B mke2fs |
| 83 | programs. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 84 | .SH OPTIONS |
| 85 | .TP |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 86 | .BI \-b " block-size" |
Theodore Ts'o | df95e09 | 2004-09-28 10:30:27 -0400 | [diff] [blame] | 87 | Specify the size of blocks in bytes. The default is 1024. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 88 | .TP |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 89 | .BI \-c " number of blocks" |
Theodore Ts'o | 167af99 | 2004-02-28 08:20:41 -0500 | [diff] [blame] | 90 | is the number of blocks which are tested at a time. The default is 64. |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 91 | .TP |
Iustin Pop | 931b028 | 2008-06-11 13:12:17 +0200 | [diff] [blame] | 92 | .BI \-e " max bad block count" |
| 93 | Specify a maximum number of bad blocks before aborting the test. The |
| 94 | default is 0, meaning the test will continue until the end of the test |
| 95 | range is reached. |
| 96 | .TP |
Iustin Pop | 264f64a | 2008-06-12 09:30:04 +0200 | [diff] [blame] | 97 | .BI \-d " read delay factor" |
| 98 | This parameter, if passed and non-zero, will cause bad blocks to sleep |
| 99 | between reads if there were no errors encountered in the read |
| 100 | operation; the delay will be calculated as a percentage of the time it |
| 101 | took for the read operation to be performed. In other words, a value of |
| 102 | 100 will cause each read to be delayed by the amount the previous read |
| 103 | took, and a value of 200 by twice the amount. |
| 104 | .TP |
Theodore Ts'o | 981dc56 | 2000-07-06 14:13:29 +0000 | [diff] [blame] | 105 | .B \-f |
| 106 | Normally, badblocks will refuse to do a read/write or a non-destructive |
Theodore Ts'o | 541d173 | 2002-02-23 21:23:26 -0500 | [diff] [blame] | 107 | test on a device which is mounted, since either can cause the system to |
Theodore Ts'o | a141135 | 2002-08-17 17:39:39 -0400 | [diff] [blame] | 108 | potentially crash and/or damage the filesystem even if it is mounted |
Theodore Ts'o | 8139367 | 2005-04-16 14:05:09 -0400 | [diff] [blame] | 109 | read-only. This can be overridden using the |
Theodore Ts'o | 541d173 | 2002-02-23 21:23:26 -0500 | [diff] [blame] | 110 | .B \-f |
| 111 | flag, but should almost never be used --- if you think you're smarter |
| 112 | than the |
| 113 | .B badblocks |
| 114 | program, you almost certainly aren't. The only time when this option |
| 115 | might be safe to use is if the /etc/mtab file is incorrect, and the device |
| 116 | really isn't mounted. |
Theodore Ts'o | 981dc56 | 2000-07-06 14:13:29 +0000 | [diff] [blame] | 117 | .TP |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 118 | .BI \-i " input_file" |
Theodore Ts'o | 4d00398 | 2000-04-03 16:01:11 +0000 | [diff] [blame] | 119 | Read a list of already existing known bad blocks. |
| 120 | .B Badblocks |
| 121 | will skip testing these blocks since they are known to be bad. If |
| 122 | .I input_file |
| 123 | is specified as "-", the list will be read from the standard input. |
| 124 | Blocks listed in this list will be omitted from the list of |
| 125 | .I new |
| 126 | bad blocks produced on the standard output or in the output file. |
| 127 | The |
| 128 | .B \-b |
| 129 | option of |
| 130 | .BR dumpe2fs (8) |
| 131 | can be used to retrieve the list of blocks currently marked bad on |
| 132 | an existing filesystem, in a format suitable for use with this option. |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 133 | .TP |
Theodore Ts'o | 4001b8a | 2009-06-29 01:03:27 -0400 | [diff] [blame] | 134 | .B \-n |
| 135 | Use non-destructive read-write mode. By default only a non-destructive |
| 136 | read-only test is done. This option must not be combined with the |
| 137 | .B \-w |
| 138 | option, as they are mutually exclusive. |
| 139 | .TP |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 140 | .BI \-o " output_file" |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 141 | Write the list of bad blocks to the specified file. Without this option, |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 142 | .B badblocks |
Theodore Ts'o | 92bcc59 | 1998-02-16 22:29:34 +0000 | [diff] [blame] | 143 | displays the list on its standard output. The format of this file is suitable |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 144 | for use by the |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 145 | . |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 146 | .B \-l |
| 147 | option in |
Theodore Ts'o | 92bcc59 | 1998-02-16 22:29:34 +0000 | [diff] [blame] | 148 | .BR e2fsck (8) |
| 149 | or |
| 150 | .BR mke2fs (8). |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 151 | .TP |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 152 | .BI \-p " num_passes" |
Theodore Ts'o | 4d00398 | 2000-04-03 16:01:11 +0000 | [diff] [blame] | 153 | Repeat scanning the disk until there are no new blocks discovered in |
| 154 | num_passes consecutive scans of the disk. |
| 155 | Default is 0, meaning |
| 156 | .B badblocks |
| 157 | will exit after the first pass. |
Theodore Ts'o | dd018f5 | 2000-02-06 23:57:07 +0000 | [diff] [blame] | 158 | .TP |
Theodore Ts'o | 4001b8a | 2009-06-29 01:03:27 -0400 | [diff] [blame] | 159 | .B \-s |
| 160 | Show the progress of the scan by writing out rough percentage completion |
| 161 | of the current badblocks pass over the disk. Note that badblocks may do |
| 162 | multiple test passes over the disk, in particular if the |
| 163 | .B \-p |
| 164 | or |
| 165 | .B \-w |
| 166 | option is requested by the user. |
| 167 | .TP |
Theodore Ts'o | 849b6bc | 2003-05-07 09:52:14 -0400 | [diff] [blame] | 168 | .BI \-t " test_pattern" |
Theodore Ts'o | 84c0545 | 2003-05-18 01:11:52 -0400 | [diff] [blame] | 169 | Specify a test pattern to be read (and written) to disk blocks. The |
| 170 | .I test_pattern |
| 171 | may either be a numeric value between 0 and ULONG_MAX-1 inclusive, or the word |
| 172 | "random", which specifies that the block should be filled with a random |
| 173 | bit pattern. |
Theodore Ts'o | 849b6bc | 2003-05-07 09:52:14 -0400 | [diff] [blame] | 174 | For read/write (\fB-w\fR) and non-destructive (\fB-n\fR) modes, |
Theodore Ts'o | 8139367 | 2005-04-16 14:05:09 -0400 | [diff] [blame] | 175 | one or more test patterns may be specified by specifying the |
Theodore Ts'o | 84c0545 | 2003-05-18 01:11:52 -0400 | [diff] [blame] | 176 | .B -t |
| 177 | option for each test pattern desired. For |
| 178 | read-only mode only a single pattern may be specified and it may not be |
| 179 | "random". Read-only testing with a pattern assumes that the |
| 180 | specified pattern has previously been written to the disk - if not, large |
Theodore Ts'o | 849b6bc | 2003-05-07 09:52:14 -0400 | [diff] [blame] | 181 | numbers of blocks will fail verification. |
| 182 | If multiple patterns |
Theodore Ts'o | d3cb5e5 | 2006-03-27 12:16:30 -0500 | [diff] [blame] | 183 | are specified then all blocks will be tested with one pattern |
Theodore Ts'o | 849b6bc | 2003-05-07 09:52:14 -0400 | [diff] [blame] | 184 | before proceeding to the next pattern. |
| 185 | .TP |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 186 | .B \-v |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 187 | Verbose mode. Will write the number of read errors, write errors and data- |
| 188 | corruptions to stderr. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 189 | .TP |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 190 | .B \-w |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 191 | Use write-mode test. With this option, |
| 192 | .B badblocks |
| 193 | scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on |
Theodore Ts'o | a551b78 | 2000-07-13 22:05:31 +0000 | [diff] [blame] | 194 | every block of the device, reading every block and comparing the contents. |
Theodore Ts'o | 177a9ac | 2001-08-30 18:07:40 -0400 | [diff] [blame] | 195 | This option may not be combined with the |
Theodore Ts'o | a551b78 | 2000-07-13 22:05:31 +0000 | [diff] [blame] | 196 | .B \-n |
| 197 | option, as they are mutually exclusive. |
Theodore Ts'o | 52a0793 | 2007-04-02 18:42:59 -0400 | [diff] [blame] | 198 | .TP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 199 | .B \-B |
| 200 | Use buffered I/O and do not use Direct I/O, even if it is available. |
| 201 | .TP |
Theodore Ts'o | 52a0793 | 2007-04-02 18:42:59 -0400 | [diff] [blame] | 202 | .B \-X |
| 203 | Internal flag only to be used by |
| 204 | .BR e2fsck (8) |
| 205 | and |
| 206 | .BR mke2fs (8). |
| 207 | It bypasses the exclusive mode in-use device safety check. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 208 | .SH WARNING |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 209 | Never use the |
| 210 | .B \-w |
Theodore Ts'o | d3cb5e5 | 2006-03-27 12:16:30 -0500 | [diff] [blame] | 211 | option on a device containing an existing file system. |
Theodore Ts'o | 4d00398 | 2000-04-03 16:01:11 +0000 | [diff] [blame] | 212 | This option erases data! If you want to do write-mode testing on |
| 213 | an existing file system, use the |
| 214 | .B \-n |
Theodore Ts'o | a551b78 | 2000-07-13 22:05:31 +0000 | [diff] [blame] | 215 | option instead. It is slower, but it will preserve your data. |
Iustin Pop | 931b028 | 2008-06-11 13:12:17 +0200 | [diff] [blame] | 216 | .PP |
| 217 | The |
| 218 | .B \-e |
| 219 | option will cause badblocks to output a possibly incomplete list of |
| 220 | bad blocks. Therefore it is recommended to use it only when one wants |
| 221 | to know if there are any bad blocks at all on the device, and not when |
| 222 | the list of bad blocks is wanted. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 223 | .SH AUTHOR |
| 224 | .B badblocks |
Theodore Ts'o | ffe4cab | 2000-04-03 13:27:41 +0000 | [diff] [blame] | 225 | was written by Remy Card <Remy.Card@linux.org>. Current maintainer is |
| 226 | Theodore Ts'o <tytso@alum.mit.edu>. Non-destructive read/write test |
Theodore Ts'o | 4d00398 | 2000-04-03 16:01:11 +0000 | [diff] [blame] | 227 | implemented by David Beattie <dbeattie@softhome.net>. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 228 | .SH AVAILABILITY |
| 229 | .B badblocks |
Theodore Ts'o | 12da49c | 2001-05-12 15:49:17 +0000 | [diff] [blame] | 230 | is part of the e2fsprogs package and is available from |
Theodore Ts'o | 348e43d | 2001-05-03 14:43:43 +0000 | [diff] [blame] | 231 | http://e2fsprogs.sourceforge.net. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 232 | .SH SEE ALSO |
| 233 | .BR e2fsck (8), |
| 234 | .BR mke2fs (8) |