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