Whamcloud - gitweb
Add a reference to e2fsck.conf(5) to the e2fsck man page
[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 \-pacnyrdfkvtDFV
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 \-t
284 Print timing statistics for
285 .BR e2fsck .
286 If this option is used twice, additional timing statistics are printed
287 on a pass by pass basis.
288 .TP
289 .B \-v
290 Verbose mode.
291 .TP
292 .B \-V
293 Print version information and exit.
294 .TP
295 .B \-y
296 Assume an answer of `yes' to all questions; allows 
297 .B e2fsck
298 to be used non-interactively.  This option
299 may not be specified at the same time as the 
300 .B \-n
301 or
302 .B \-p
303 options.
304 .SH EXIT CODE
305 The exit code returned by
306 .B e2fsck
307 is the sum of the following conditions:
308 .br
309 \       0\      \-\ No errors
310 .br
311 \       1\      \-\ File system errors corrected
312 .br
313 \       2\      \-\ File system errors corrected, system should
314 .br
315 \       \       \ \ be rebooted
316 .br
317 \       4\      \-\ File system errors left uncorrected
318 .br
319 \       8\      \-\ Operational error
320 .br
321 \       16\     \-\ Usage or syntax error
322 .br
323 \       32\     \-\ E2fsck canceled by user request
324 .br
325 \       128\    \-\ Shared library error
326 .br
327 .SH SIGNALS
328 The following signals have the following effect when sent to 
329 .BR e2fsck .
330 .TP
331 .B SIGUSR1
332 This signal causes
333 .B e2fsck
334 to start displaying a completion bar or emitting progress information.  
335 (See discussion of the 
336 .B \-C
337 option.)
338 .TP
339 .B SIGUSR2
340 This signal causes
341 .B e2fsck 
342 to stop displaying a completion bar or emitting progress information.
343 .SH REPORTING BUGS
344 Almost any piece of software will have bugs.  If you manage to find a
345 filesystem which causes 
346 .B e2fsck
347 to crash, or which 
348 .B e2fsck
349 is unable to repair, please report it to the author.
350 .PP
351 Please include as much information as possible in your bug report.
352 Ideally, include a complete transcript of the
353 .B e2fsck
354 run, so I can see exactly what error messages are displayed.  (Make sure
355 the messages printed by 
356 .B e2fsck 
357 are in English; if your system has been
358 configured so that 
359 .BR e2fsck 's
360 messages have been translated into another language, please set the the
361 .B LC_ALL
362 environment variable to
363 .B C
364 so that the transcript of e2fsck's output will be useful to me.)
365 If you
366 have a writable filesystem where the transcript can be stored, the 
367 .BR script (1)
368 program is a handy way to save the output of
369 .B e2fsck
370 to a file.
371 .PP
372 It is also useful to send the output of 
373 .BR dumpe2fs (8).
374 If a specific inode or inodes seems to be giving 
375 .B e2fsck 
376 trouble, try running the
377 .BR debugfs (8)
378 command and send the output of the 
379 .BR stat (1u)
380 command run on the relevant inode(s).  If the inode is a directory, the 
381 .B debugfs
382 .I dump
383 command will allow you to extract the contents of the directory inode,
384 which can sent to me after being first run through
385 .BR uuencode (1).  
386 The most useful data you can send to help reproduce
387 the bug is a compressed raw image dump of the filesystem, generated using
388 .BR e2image (8).
389 See the 
390 .BR e2image (8)
391 man page for more details.
392 .PP
393 Always include the full version string which 
394 .B e2fsck
395 displays when it is run, so I know which version you are running.
396 .SH AUTHOR
397 This version of 
398 .B e2fsck
399 was written by Theodore Ts'o <tytso@mit.edu>.
400 .SH SEE ALSO
401 .BR e2fsck.conf (5),
402 .BR badblocks (8),
403 .BR dumpe2fs (8),
404 .BR debugfs (8),
405 .BR e2image (8),
406 .BR mke2fs (8),
407 .BR tune2fs (8)