Whamcloud - gitweb
e2fsck: Support a negative argument to -C to suppress progress information
[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 number is negative, then absolute value of
143 the file descriptor will be used, and the progress information will be
144 suppressed initially.  It can later be enabled by sending the
145 .B e2fsck
146 process a SIGUSR1 signal.
147 If the file descriptor specified is 0, 
148 .B e2fsck
149 will print a completion bar as it goes about its business.  This requires
150 that e2fsck is running on a video console or terminal.
151 .TP
152 .B \-d
153 Print debugging output (useless unless you are debugging
154 .BR e2fsck ).
155 .TP
156 .B \-D
157 Optimize directories in filesystem.  This option causes e2fsck to
158 try to optimize all directories, either by reindexing them if the
159 filesystem supports directory indexing,  or by sorting and compressing
160 directories for smaller directories, or for filesystems using
161 traditional linear directories.
162 .IP
163 Even without the
164 .B \-D
165 option,
166 .B e2fsck
167 may sometimes optimize a few directories --- for example, if
168 directory indexing is enabled and a directory is not indexed and would
169 benefit from being indexed, or if the index structures are corrupted
170 and need to be rebuilt.  The
171 .B \-D
172 option forces all directories in the filesystem to be optimized.  This can
173 sometimes make them a little smaller and slightly faster to search, but
174 in practice, you should rarely need to use this option.
175 .IP
176 The
177 .B \-D
178 option will detect directory entries with duplicate names in a single
179 directory, which e2fsck normally does not enforce for performance reasons.
180 .TP
181 .BI \-E " extended_options"
182 Set e2fsck extended options.  Extended options are comma
183 separated, and may take an argument using the equals ('=') sign.  The 
184 following options are supported:
185 .RS 1.2i
186 .TP
187 .BI ea_ver= extended_attribute_version
188 Assume the format of the extended attribute blocks in the filesystem is
189 the specified version number.  The version number may be 1 or 2.  The
190 default extended attribute version format is 2.
191 .RE
192 .TP
193 .B \-f
194 Force checking even if the file system seems clean.
195 .TP
196 .B \-F
197 Flush the filesystem device's buffer caches before beginning.  Only
198 really useful for doing 
199 .B e2fsck 
200 time trials.
201 @JDEV@.TP
202 @JDEV@.BI \-j " external-journal"
203 @JDEV@Set the pathname where the external-journal for this filesystem can be
204 @JDEV@found.
205 .TP
206 .BI \-k
207 When combined with the 
208 .B \-c
209 option, any existing bad blocks in the bad blocks list are preserved,
210 and any new bad blocks found by running
211 .BR badblocks (8) 
212 will be added to the existing bad blocks list.
213 .TP
214 .BI \-l " filename"
215 Add the block numbers listed in the file specified by 
216 .I filename
217 to the list of bad blocks.  The format of this file is the same as the
218 one generated by the 
219 .BR badblocks (8)
220 program.  Note that the block numbers are based on the blocksize
221 of the filesystem.  Hence, 
222 .BR badblocks (8)
223 must be given the blocksize of the filesystem in order to obtain correct
224 results.  As a result, it is much simpler and safer to use the 
225 .B -c
226 option to 
227 .BR e2fsck ,
228 since it will assure that the correct parameters are passed to the
229 .B badblocks
230 program.
231 .TP
232 .BI \-L " filename"
233 Set the bad blocks list to be the list of blocks specified by 
234 .IR filename .
235 (This option is the same as the 
236 .B \-l
237 option, except the bad blocks list is cleared before the blocks listed
238 in the file are added to the bad blocks list.)
239 .TP
240 .B \-n
241 Open the filesystem read-only, and assume an answer of `no' to all
242 questions.  Allows
243 .B e2fsck
244 to be used non-interactively.  (Note: if the 
245 .BR \-c ,
246 .BR \-l ,
247 or
248 .B \-L
249 options are specified in addition to the 
250 .B \-n
251 option, then the filesystem will be opened read-write, to permit the
252 bad-blocks list to be updated.  However, no other changes will be made
253 to the filesystem.)  This option
254 may not be specified at the same time as the 
255 .B \-p
256 or
257 .B \-y
258 options.
259 .TP
260 .B \-p
261 Automatically repair ("preen") the file system.  This option will case
262 .B e2fsck
263 to automatically
264 fix any filesystem problems that can be safely fixed without human
265 intervention.  If 
266 .B e2fsck
267 discovers a problem which may require the system administrator
268 to take additional corrective action, 
269 .B e2fsck
270 will print a description of the problem and then exit with the value 4
271 logically or'ed into the exit code.  (See the \fBEXIT CODE\fR section.)
272 This option is normally used by the system's boot scripts.  It may not 
273 be specified at the same time as the
274 .B \-n
275 or
276 .B \-y
277 options.
278 .TP
279 .B \-r
280 This option does nothing at all; it is provided only for backwards
281 compatibility.
282 .TP 
283 .B \-s
284 This option will byte-swap the filesystem so that it is using the normalized, 
285 standard byte-order (which is i386 or little endian).  If the filesystem is
286 already in the standard byte-order, 
287 .B e2fsck 
288 will take no action.
289 .TP
290 .B \-S
291 This option will byte-swap the filesystem, regardless of its current 
292 byte-order.
293 .TP
294 .B \-t
295 Print timing statistics for
296 .BR e2fsck .
297 If this option is used twice, additional timing statistics are printed
298 on a pass by pass basis.
299 .TP
300 .B \-v
301 Verbose mode.
302 .TP
303 .B \-V
304 Print version information and exit.
305 .TP
306 .B \-y
307 Assume an answer of `yes' to all questions; allows 
308 .B e2fsck
309 to be used non-interactively.  This option
310 may not be specified at the same time as the 
311 .B \-n
312 or
313 .B \-p
314 options.
315 .SH EXIT CODE
316 The exit code returned by
317 .B e2fsck
318 is the sum of the following conditions:
319 .br
320 \       0\      \-\ No errors
321 .br
322 \       1\      \-\ File system errors corrected
323 .br
324 \       2\      \-\ File system errors corrected, system should
325 .br
326 \       \       \ \ be rebooted
327 .br
328 \       4\      \-\ File system errors left uncorrected
329 .br
330 \       8\      \-\ Operational error
331 .br
332 \       16\     \-\ Usage or syntax error
333 .br
334 \       32\     \-\ E2fsck canceled by user request
335 .br
336 \       128\    \-\ Shared library error
337 .br
338 .SH SIGNALS
339 The following signals have the following effect when sent to 
340 .BR e2fsck .
341 .TP
342 .B SIGUSR1
343 This signal causes
344 .B e2fsck
345 to start displaying a completion bar or emitting progress information.  
346 (See discussion of the 
347 .B \-C
348 option.)
349 .TP
350 .B SIGUSR2
351 This signal causes
352 .B e2fsck 
353 to stop displaying a completion bar or emitting progress information.
354 .SH REPORTING BUGS
355 Almost any piece of software will have bugs.  If you manage to find a
356 filesystem which causes 
357 .B e2fsck
358 to crash, or which 
359 .B e2fsck
360 is unable to repair, please report it to the author.
361 .PP
362 Please include as much information as possible in your bug report.
363 Ideally, include a complete transcript of the
364 .B e2fsck
365 run, so I can see exactly what error messages are displayed.  (Make sure
366 the messages printed by 
367 .B e2fsck 
368 are in English; if your system has been
369 configured so that 
370 .BR e2fsck 's
371 messages have been translated into another language, please set the the
372 .B LC_ALL
373 environment variable to
374 .B C
375 so that the transcript of e2fsck's output will be useful to me.)
376 If you
377 have a writable filesystem where the transcript can be stored, the 
378 .BR script (1)
379 program is a handy way to save the output of
380 .B e2fsck
381 to a file.
382 .PP
383 It is also useful to send the output of 
384 .BR dumpe2fs (8).
385 If a specific inode or inodes seems to be giving 
386 .B e2fsck 
387 trouble, try running the
388 .BR debugfs (8)
389 command and send the output of the 
390 .BR stat (1u)
391 command run on the relevant inode(s).  If the inode is a directory, the 
392 .B debugfs
393 .I dump
394 command will allow you to extract the contents of the directory inode,
395 which can sent to me after being first run through
396 .BR uuencode (1).  
397 The most useful data you can send to help reproduce
398 the bug is a compressed raw image dump of the filesystem, generated using
399 .BR e2image (8).
400 See the 
401 .BR e2image (8)
402 man page for more details.
403 .PP
404 Always include the full version string which 
405 .B e2fsck
406 displays when it is run, so I know which version you are running.
407 .SH AUTHOR
408 This version of 
409 .B e2fsck
410 was written by Theodore Ts'o <tytso@mit.edu>.
411 .SH SEE ALSO
412 .BR badblocks (8),
413 .BR dumpe2fs (8),
414 .BR debugfs (8),
415 .BR e2image (8),
416 .BR mke2fs (8),
417 .BR tune2fs (8)