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