Whamcloud - gitweb
e2fsck: Document that the -D option finds duplicate file names
[tools/e2fsprogs.git] / e2fsck / e2fsck.8.in
1 .\" -*- nroff -*-
2 .\" Copyright 1993, 1994, 1995 by Theodore Ts'o.  All Rights Reserved.
3 .\" This file may be copied under the terms of the GNU Public License.
4 .\" 
5 .TH E2FSCK 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
6 .SH NAME
7 e2fsck \- check a Linux ext2/ext3 file system
8 .SH SYNOPSIS
9 .B e2fsck
10 [
11 .B \-pacnyrdfkvstDFSV
12 ]
13 [
14 .B \-b
15 .I superblock
16 ]
17 [
18 .B \-B
19 .I blocksize
20 ]
21 [
22 .BR \-l | \-L
23 .I bad_blocks_file
24 ]
25 [
26 .B \-C
27 .I fd
28 ]
29 @JDEV@[
30 @JDEV@.B \-j
31 @JDEV@.I external-journal
32 @JDEV@]
33 [
34 .B \-E
35 .I extended_options
36 ]
37 .I device
38 .SH DESCRIPTION
39 .B e2fsck
40 is used to check a Linux second extended file system (ext2fs).  
41 .B E2fsck
42 also 
43 supports ext2 filesystems containing a journal, which are
44 also sometimes known as ext3 filesystems, by first applying the journal 
45 to the filesystem before continuing with normal 
46 .B e2fsck
47 processing.  After the journal has been applied, a filesystem will
48 normally be marked as clean.  Hence, for ext3 filesystems, 
49 .B e2fsck
50 will normally run the journal and exit, unless its superblock
51 indicates that further checking is required.
52 .PP
53 .I device
54 is the device file where the filesystem is stored (e.g.
55 .IR /dev/hdc1 ).
56 .PP
57 Note that in general it is not safe to run
58 .B e2fsck
59 on mounted filesystems.  The only exception is if the
60 .B \-n
61 option is specified, and 
62 .BR \-c , 
63 .BR \-l ,
64 or
65 .B -L
66 options are 
67 .I not
68 specified.   However, even if it is safe to do so, the results printed by
69 .B e2fsck
70 are not valid if the filesystem is mounted.   If 
71 .B e2fsck
72 asks whether or not you should check a filesystem which is mounted, 
73 the only correct answer is ``no''.  Only experts who really know what
74 they are doing should consider answering this question in any other way.
75 .SH OPTIONS
76 .TP
77 .B \-a 
78 This option does the same thing as the 
79 .B \-p
80 option.  It is provided for backwards compatibility only; it is
81 suggested that people use 
82 .B \-p 
83 option whenever possible.
84 .TP
85 .BI \-b " superblock"
86 Instead of using the normal superblock, use an alternative superblock
87 specified by 
88 .IR superblock .
89 This option is normally used when the primary superblock has been
90 corrupted.  The location of the backup superblock is dependent on the
91 filesystem's blocksize.  For filesystems with 1k blocksizes, a backup
92 superblock can be found at block 8193; for filesystems with 2k
93 blocksizes, at block 16384; and for 4k blocksizes, at block 32768.  
94 .IP
95 Additional backup superblocks can be determined by using the 
96 .B mke2fs 
97 program using the 
98 .B \-n
99 option to print out where the superblocks were created.   The 
100 .B \-b 
101 option to 
102 .BR mke2fs ,
103 which specifies blocksize of the filesystem must be specified in order
104 for the superblock locations that are printed out to be accurate.
105 .IP
106 If an alternative superblock is specified and  
107 the filesystem is not opened read-only, e2fsck will make sure that the
108 primary superblock is updated appropriately upon completion of the 
109 filesystem check.
110 .TP
111 .BI \-B " blocksize"
112 Normally, 
113 .B e2fsck
114 will search for the superblock at various different
115 block sizes in an attempt to find the appropriate block size.
116 This search can be fooled in some cases.  This option forces 
117 .B e2fsck
118 to only try locating the superblock at a particular blocksize.
119 If the superblock is not found, 
120 .B e2fsck 
121 will terminate with a fatal error.
122 .TP
123 .B \-c
124 This option causes 
125 .B e2fsck 
126 to use 
127 .BR badblocks (8)
128 program to do a read-only scan of the device in order to find any bad
129 blocks.  If any bad blocks are found, they are added to the bad block
130 inode to prevent them from being allocated to a file or directory.  If
131 this option is specified twice, then the bad block scan will be done
132 using a non-destructive read-write test.
133 .TP
134 .BI \-C " fd"
135 This option causes
136 .B e2fsck
137 to write completion information to the specified file descriptor 
138 so that the progress of the filesystem 
139 check can be monitored.  This option is typically used by programs 
140 which are running
141 .BR e2fsck .
142 If the file descriptor specified is 0, 
143 .B e2fsck
144 will print a completion bar as it goes about its business.  This requires
145 that e2fsck is running on a video console or terminal.
146 .TP
147 .B \-d
148 Print debugging output (useless unless you are debugging
149 .BR e2fsck ).
150 .TP
151 .B \-D
152 Optimize directories in filesystem.  This option causes e2fsck to
153 try to optimize all directories, either by reindexing them if the
154 filesystem supports directory indexing,  or by sorting and compressing
155 directories for smaller directories, or for filesystems using
156 traditional linear directories.
157 .IP
158 Even without the
159 .B \-D
160 option,
161 .B e2fsck
162 may sometimes optimize a few directories --- for example, if
163 directory indexing is enabled and a directory is not indexed and would
164 benefit from being indexed, or if the index structures are corrupted
165 and need to be rebuilt.  The
166 .B \-D
167 option forces all directories in the filesystem to be optimized.  This can
168 sometimes make them a little smaller and slightly faster to search, but
169 in practice, you should rarely need to use this option.
170 .IP
171 The
172 .B \-D
173 option will detect directory entries with duplicate names in a single
174 directory, which e2fsck normally does not enforce for performance reasons.
175 .TP
176 .BI \-E " extended_options"
177 Set e2fsck extended options.  Extended options are comma
178 separated, and may take an argument using the equals ('=') sign.  The 
179 following options are supported:
180 .RS 1.2i
181 .TP
182 .BI ea_ver= extended_attribute_version
183 Assume the format of the extended attribute blocks in the filesystem is
184 the specified version number.  The version number may be 1 or 2.  The
185 default extended attribute version format is 2.
186 .RE
187 .TP
188 .B \-f
189 Force checking even if the file system seems clean.
190 .TP
191 .B \-F
192 Flush the filesystem device's buffer caches before beginning.  Only
193 really useful for doing 
194 .B e2fsck 
195 time trials.
196 @JDEV@.TP
197 @JDEV@.BI \-j " external-journal"
198 @JDEV@Set the pathname where the external-journal for this filesystem can be
199 @JDEV@found.
200 .TP
201 .BI \-k
202 When combined with the 
203 .B \-c
204 option, any existing bad blocks in the bad blocks list are preserved,
205 and any new bad blocks found by running
206 .BR badblocks (8) 
207 will be added to the existing bad blocks list.
208 .TP
209 .BI \-l " filename"
210 Add the block numbers listed in the file specified by 
211 .I filename
212 to the list of bad blocks.  The format of this file is the same as the
213 one generated by the 
214 .BR badblocks (8)
215 program.  Note that the block numbers are based on the blocksize
216 of the filesystem.  Hence, 
217 .BR badblocks (8)
218 must be given the blocksize of the filesystem in order to obtain correct
219 results.  As a result, it is much simpler and safer to use the 
220 .B -c
221 option to 
222 .BR e2fsck ,
223 since it will assure that the correct parameters are passed to the
224 .B badblocks
225 program.
226 .TP
227 .BI \-L " filename"
228 Set the bad blocks list to be the list of blocks specified by 
229 .IR filename .
230 (This option is the same as the 
231 .B \-l
232 option, except the bad blocks list is cleared before the blocks listed
233 in the file are added to the bad blocks list.)
234 .TP
235 .B \-n
236 Open the filesystem read-only, and assume an answer of `no' to all
237 questions.  Allows
238 .B e2fsck
239 to be used non-interactively.  (Note: if the 
240 .BR \-c ,
241 .BR \-l ,
242 or
243 .B \-L
244 options are specified in addition to the 
245 .B \-n
246 option, then the filesystem will be opened read-write, to permit the
247 bad-blocks list to be updated.  However, no other changes will be made
248 to the filesystem.)  This option
249 may not be specified at the same time as the 
250 .B \-p
251 or
252 .B \-y
253 options.
254 .TP
255 .B \-p
256 Automatically repair ("preen") the file system.  This option will case
257 .B e2fsck
258 to automatically
259 fix any filesystem problems that can be safely fixed without human
260 intervention.  If 
261 .B e2fsck
262 discovers a problem which may require the system administrator
263 to take additional corrective action, 
264 .B e2fsck
265 will print a description of the problem and then exit with the value 4
266 logically or'ed into the exit code.  (See the \fBEXIT CODE\fR section.)
267 This option is normally used by the system's boot scripts.  It may not 
268 be specified at the same time as the
269 .B \-n
270 or
271 .B \-y
272 options.
273 .TP
274 .B \-r
275 This option does nothing at all; it is provided only for backwards
276 compatibility.
277 .TP 
278 .B \-s
279 This option will byte-swap the filesystem so that it is using the normalized, 
280 standard byte-order (which is i386 or little endian).  If the filesystem is
281 already in the standard byte-order, 
282 .B e2fsck 
283 will take no action.
284 .TP
285 .B \-S
286 This option will byte-swap the filesystem, regardless of its current 
287 byte-order.
288 .TP
289 .B \-t
290 Print timing statistics for
291 .BR e2fsck .
292 If this option is used twice, additional timing statistics are printed
293 on a pass by pass basis.
294 .TP
295 .B \-v
296 Verbose mode.
297 .TP
298 .B \-V
299 Print version information and exit.
300 .TP
301 .B \-y
302 Assume an answer of `yes' to all questions; allows 
303 .B e2fsck
304 to be used non-interactively.  This option
305 may not be specified at the same time as the 
306 .B \-n
307 or
308 .B \-p
309 options.
310 .SH EXIT CODE
311 The exit code returned by
312 .B e2fsck
313 is the sum of the following conditions:
314 .br
315 \       0\      \-\ No errors
316 .br
317 \       1\      \-\ File system errors corrected
318 .br
319 \       2\      \-\ File system errors corrected, system should
320 .br
321 \       \       \ \ be rebooted
322 .br
323 \       4\      \-\ File system errors left uncorrected
324 .br
325 \       8\      \-\ Operational error
326 .br
327 \       16\     \-\ Usage or syntax error
328 .br
329 \       32\     \-\ E2fsck canceled by user request
330 .br
331 \       128\    \-\ Shared library error
332 .br
333 .SH SIGNALS
334 The following signals have the following effect when sent to 
335 .BR e2fsck .
336 .TP
337 .B SIGUSR1
338 This signal causes
339 .B e2fsck
340 to start displaying a completion bar.  (See discussion of the 
341 .B \-C
342 option.)
343 .TP
344 .B SIGUSR2
345 This signal causes
346 .B e2fsck 
347 to stop displaying a completion bar.
348 .SH REPORTING BUGS
349 Almost any piece of software will have bugs.  If you manage to find a
350 filesystem which causes 
351 .B e2fsck
352 to crash, or which 
353 .B e2fsck
354 is unable to repair, please report it to the author.
355 .PP
356 Please include as much information as possible in your bug report.
357 Ideally, include a complete transcript of the
358 .B e2fsck
359 run, so I can see exactly what error messages are displayed.  (Make sure
360 the messages printed by 
361 .B e2fsck 
362 are in English; if your system has been
363 configured so that 
364 .BR e2fsck 's
365 messages have been translated into another language, please set the the
366 .B LC_ALL
367 environment variable to
368 .B C
369 so that the transcript of e2fsck's output will be useful to me.)
370 If you
371 have a writable filesystem where the transcript can be stored, the 
372 .BR script (1)
373 program is a handy way to save the output of
374 .B e2fsck
375 to a file.
376 .PP
377 It is also useful to send the output of 
378 .BR dumpe2fs (8).
379 If a specific inode or inodes seems to be giving 
380 .B e2fsck 
381 trouble, try running the
382 .BR debugfs (8)
383 command and send the output of the 
384 .BR stat (1u)
385 command run on the relevant inode(s).  If the inode is a directory, the 
386 .B debugfs
387 .I dump
388 command will allow you to extract the contents of the directory inode,
389 which can sent to me after being first run through
390 .BR uuencode (1).  
391 The most useful data you can send to help reproduce
392 the bug is a compressed raw image dump of the filesystem, generated using
393 .BR e2image (8).
394 See the 
395 .BR e2image (8)
396 man page for more details.
397 .PP
398 Always include the full version string which 
399 .B e2fsck
400 displays when it is run, so I know which version you are running.
401 .SH AUTHOR
402 This version of 
403 .B e2fsck
404 was written by Theodore Ts'o <tytso@mit.edu>.
405 .SH SEE ALSO
406 .BR badblocks (8),
407 .BR dumpe2fs (8),
408 .BR debugfs (8),
409 .BR e2image (8),
410 .BR mke2fs (8),
411 .BR tune2fs (8)