blob: 9707a4c30ed3acebf5fcbfb057c6d75729d2494a [file] [log] [blame]
Theodore Ts'o3839e651997-04-26 13:21:57 +00001.\" -*- nroff -*-
Theodore Ts'o50e1e101997-04-26 13:58:21 +00002.\" Copyright 1993, 1994, 1995 by Theodore Ts'o. All Rights Reserved.
Theodore Ts'o3839e651997-04-26 13:21:57 +00003.\" This file may be copied under the terms of the GNU Public License.
4.\"
Theodore Ts'o74becf31997-04-26 14:37:06 +00005.TH E2FSCK 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
Theodore Ts'o3839e651997-04-26 13:21:57 +00006.SH NAME
Theodore Ts'oa7ac1df2003-08-24 17:56:41 -04007e2fsck \- check a Linux ext2/ext3 file system
Theodore Ts'o3839e651997-04-26 13:21:57 +00008.SH SYNOPSIS
9.B e2fsck
10[
Theodore Ts'o1a855cb2007-08-10 23:58:56 -040011.B \-pacnyrdfkvtDFV
Theodore Ts'o3839e651997-04-26 13:21:57 +000012]
13[
14.B \-b
15.I superblock
16]
17[
18.B \-B
19.I blocksize
20]
21[
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000022.BR \-l | \-L
Theodore Ts'o3839e651997-04-26 13:21:57 +000023.I bad_blocks_file
24]
Theodore Ts'oefac9a11998-05-07 05:02:00 +000025[
26.B \-C
27.I fd
28]
Theodore Ts'oadee8d72001-07-23 00:17:49 -040029@JDEV@[
30@JDEV@.B \-j
31@JDEV@.I external-journal
32@JDEV@]
Theodore Ts'o0684a4f2002-08-17 10:19:44 -040033[
34.B \-E
35.I extended_options
36]
Theodore Ts'o3839e651997-04-26 13:21:57 +000037.I device
38.SH DESCRIPTION
39.B e2fsck
Theodore Ts'of044b4d2002-08-17 13:32:21 -040040is used to check a Linux second extended file system (ext2fs).
41.B E2fsck
42also
Theodore Ts'o81393672005-04-16 14:05:09 -040043supports ext2 filesystems containing a journal, which are
Theodore Ts'of044b4d2002-08-17 13:32:21 -040044also sometimes known as ext3 filesystems, by first applying the journal
45to the filesystem before continuing with normal
46.B e2fsck
47processing. After the journal has been applied, a filesystem will
48normally be marked as clean. Hence, for ext3 filesystems,
49.B e2fsck
50will normally run the journal and exit, unless its superblock
51indicates that further checking is required.
Theodore Ts'o1e9a7e02001-11-24 16:40:57 -050052.PP
Theodore Ts'o3839e651997-04-26 13:21:57 +000053.I device
Theodore Ts'o1e9a7e02001-11-24 16:40:57 -050054is the device file where the filesystem is stored (e.g.
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000055.IR /dev/hdc1 ).
Theodore Ts'o73d1d492005-06-19 21:04:12 -040056.PP
57Note that in general it is not safe to run
58.B e2fsck
59on mounted filesystems. The only exception is if the
60.B \-n
61option is specified, and
62.BR \-c ,
63.BR \-l ,
64or
65.B -L
66options are
67.I not
68specified. However, even if it is safe to do so, the results printed by
69.B e2fsck
70are not valid if the filesystem is mounted. If
71.B e2fsck
72asks whether or not you should check a filesystem which is mounted,
73the only correct answer is ``no''. Only experts who really know what
Theodore Ts'o5fb86b42005-06-20 08:24:28 -040074they are doing should consider answering this question in any other way.
Theodore Ts'o3839e651997-04-26 13:21:57 +000075.SH OPTIONS
76.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000077.B \-a
Theodore Ts'of3db3561997-04-26 13:34:30 +000078This option does the same thing as the
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000079.B \-p
Theodore Ts'of3db3561997-04-26 13:34:30 +000080option. It is provided for backwards compatibility only; it is
81suggested that people use
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000082.B \-p
Theodore Ts'o583ccdc1997-05-09 03:06:31 +000083option whenever possible.
Theodore Ts'of3db3561997-04-26 13:34:30 +000084.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000085.BI \-b " superblock"
Theodore Ts'o24dd4021998-02-01 00:16:40 +000086Instead of using the normal superblock, use an alternative superblock
Theodore Ts'o3839e651997-04-26 13:21:57 +000087specified by
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000088.IR superblock .
89This option is normally used when the primary superblock has been
Theodore Ts'oa1ccadb1999-11-23 13:57:16 +000090corrupted. The location of the backup superblock is dependent on the
91filesystem's blocksize. For filesystems with 1k blocksizes, a backup
92superblock can be found at block 8193; for filesystems with 2k
Theodore Ts'o5f629b72001-05-01 20:01:08 +000093blocksizes, at block 16384; and for 4k blocksizes, at block 32768.
94.IP
95Additional backup superblocks can be determined by using the
96.B mke2fs
97program using the
98.B \-n
99option to print out where the superblocks were created. The
100.B \-b
101option to
102.BR mke2fs ,
103which specifies blocksize of the filesystem must be specified in order
104for the superblock locations that are printed out to be accurate.
105.IP
106If an alternative superblock is specified and
Theodore Ts'o24dd4021998-02-01 00:16:40 +0000107the filesystem is not opened read-only, e2fsck will make sure that the
108primary superblock is updated appropriately upon completion of the
109filesystem check.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000110.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000111.BI \-B " blocksize"
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000112Normally,
113.B e2fsck
114will search for the superblock at various different
115block sizes in an attempt to find the appropriate block size.
116This search can be fooled in some cases. This option forces
117.B e2fsck
118to only try locating the superblock at a particular blocksize.
119If the superblock is not found,
120.B e2fsck
121will terminate with a fatal error.
Theodore Ts'of3db3561997-04-26 13:34:30 +0000122.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000123.B \-c
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000124This option causes
125.B e2fsck
Theodore Ts'obba44f92005-12-09 18:18:06 -0500126to use
Theodore Ts'o74becf31997-04-26 14:37:06 +0000127.BR badblocks (8)
Theodore Ts'obba44f92005-12-09 18:18:06 -0500128program to do a read-only scan of the device in order to find any bad
129blocks. If any bad blocks are found, they are added to the bad block
130inode to prevent them from being allocated to a file or directory. If
131this option is specified twice, then the bad block scan will be done
Theodore Ts'o3ed57c22001-12-24 15:01:59 -0500132using a non-destructive read-write test.
Theodore Ts'o74becf31997-04-26 14:37:06 +0000133.TP
Theodore Ts'o77be4d22003-03-06 12:39:55 -0500134.BI \-C " fd"
Theodore Ts'oefac9a11998-05-07 05:02:00 +0000135This option causes
136.B e2fsck
137to write completion information to the specified file descriptor
138so that the progress of the filesystem
Theodore Ts'o5596def1999-07-19 15:27:37 +0000139check can be monitored. This option is typically used by programs
140which are running
141.BR e2fsck .
Theodore Ts'obe625232008-03-26 08:26:01 -0400142If the file descriptor number is negative, then absolute value of
143the file descriptor will be used, and the progress information will be
144suppressed initially. It can later be enabled by sending the
145.B e2fsck
146process a SIGUSR1 signal.
Theodore Ts'o5596def1999-07-19 15:27:37 +0000147If the file descriptor specified is 0,
Theodore Ts'oefac9a11998-05-07 05:02:00 +0000148.B e2fsck
Theodore Ts'o5596def1999-07-19 15:27:37 +0000149will print a completion bar as it goes about its business. This requires
150that e2fsck is running on a video console or terminal.
Theodore Ts'oefac9a11998-05-07 05:02:00 +0000151.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000152.B \-d
Theodore Ts'o3839e651997-04-26 13:21:57 +0000153Print debugging output (useless unless you are debugging
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000154.BR e2fsck ).
Theodore Ts'o3839e651997-04-26 13:21:57 +0000155.TP
Theodore Ts'o850d05e2002-07-25 00:00:08 -0400156.B \-D
157Optimize directories in filesystem. This option causes e2fsck to
158try to optimize all directories, either by reindexing them if the
159filesystem supports directory indexing, or by sorting and compressing
160directories for smaller directories, or for filesystems using
161traditional linear directories.
Theodore Ts'o1e5c6d32008-01-01 00:17:57 -0500162.IP
163Even without the
164.B \-D
165option,
166.B e2fsck
167may sometimes optimize a few directories --- for example, if
168directory indexing is enabled and a directory is not indexed and would
169benefit from being indexed, or if the index structures are corrupted
170and need to be rebuilt. The
171.B \-D
172option forces all directories in the filesystem to be optimized. This can
173sometimes make them a little smaller and slightly faster to search, but
174in practice, you should rarely need to use this option.
Theodore Ts'oa3d9d372008-02-26 12:50:51 -0500175.IP
176The
177.B \-D
178option will detect directory entries with duplicate names in a single
179directory, which e2fsck normally does not enforce for performance reasons.
Theodore Ts'o850d05e2002-07-25 00:00:08 -0400180.TP
Theodore Ts'o0684a4f2002-08-17 10:19:44 -0400181.BI \-E " extended_options"
182Set e2fsck extended options. Extended options are comma
183separated, and may take an argument using the equals ('=') sign. The
184following options are supported:
185.RS 1.2i
186.TP
187.BI ea_ver= extended_attribute_version
Theodore Ts'o63b5e352008-08-10 22:43:24 -0400188Set the version of the extended attribute blocks which
189.B e2fsck
190will require while checking the filesystem. The version number may
191be 1 or 2. The default extended attribute version format is 2.
192.TP
193.BI fragcheck
194During pass 1, print a detailed report of any discontiguous blocks for
195files in the filesystem.
Theodore Ts'o0684a4f2002-08-17 10:19:44 -0400196.RE
197.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000198.B \-f
Theodore Ts'o3839e651997-04-26 13:21:57 +0000199Force checking even if the file system seems clean.
200.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000201.B \-F
Theodore Ts'o3839e651997-04-26 13:21:57 +0000202Flush the filesystem device's buffer caches before beginning. Only
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000203really useful for doing
204.B e2fsck
205time trials.
Theodore Ts'oadee8d72001-07-23 00:17:49 -0400206@JDEV@.TP
207@JDEV@.BI \-j " external-journal"
208@JDEV@Set the pathname where the external-journal for this filesystem can be
209@JDEV@found.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000210.TP
Theodore Ts'o4fb9d522004-02-24 00:16:09 -0500211.BI \-k
212When combined with the
213.B \-c
214option, any existing bad blocks in the bad blocks list are preserved,
215and any new bad blocks found by running
216.BR badblocks (8)
217will be added to the existing bad blocks list.
218.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000219.BI \-l " filename"
Theodore Ts'o3ed57c22001-12-24 15:01:59 -0500220Add the block numbers listed in the file specified by
Theodore Ts'o3839e651997-04-26 13:21:57 +0000221.I filename
Theodore Ts'o43139321998-02-16 22:34:46 +0000222to the list of bad blocks. The format of this file is the same as the
223one generated by the
224.BR badblocks (8)
Theodore Ts'o3ed57c22001-12-24 15:01:59 -0500225program. Note that the block numbers are based on the blocksize
226of the filesystem. Hence,
227.BR badblocks (8)
228must be given the blocksize of the filesystem in order to obtain correct
229results. As a result, it is much simpler and safer to use the
230.B -c
231option to
232.BR e2fsck ,
233since it will assure that the correct parameters are passed to the
234.B badblocks
Theodore Ts'o43139321998-02-16 22:34:46 +0000235program.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000236.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000237.BI \-L " filename"
Theodore Ts'o3839e651997-04-26 13:21:57 +0000238Set the bad blocks list to be the list of blocks specified by
239.IR filename .
240(This option is the same as the
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000241.B \-l
Theodore Ts'o3839e651997-04-26 13:21:57 +0000242option, except the bad blocks list is cleared before the blocks listed
243in the file are added to the bad blocks list.)
244.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000245.B \-n
246Open the filesystem read-only, and assume an answer of `no' to all
Theodore Ts'o3839e651997-04-26 13:21:57 +0000247questions. Allows
248.B e2fsck
249to be used non-interactively. (Note: if the
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000250.BR \-c ,
251.BR \-l ,
Theodore Ts'o3839e651997-04-26 13:21:57 +0000252or
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000253.B \-L
Theodore Ts'o3839e651997-04-26 13:21:57 +0000254options are specified in addition to the
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000255.B \-n
Theodore Ts'o3839e651997-04-26 13:21:57 +0000256option, then the filesystem will be opened read-write, to permit the
257bad-blocks list to be updated. However, no other changes will be made
Theodore Ts'o84d35182005-12-09 17:28:56 -0500258to the filesystem.) This option
259may not be specified at the same time as the
260.B \-p
261or
262.B \-y
263options.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000264.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000265.B \-p
Theodore Ts'o84d35182005-12-09 17:28:56 -0500266Automatically repair ("preen") the file system. This option will case
267.B e2fsck
268to automatically
269fix any filesystem problems that can be safely fixed without human
270intervention. If
271.B e2fsck
272discovers a problem which may require the system administrator
273to take additional corrective action,
274.B e2fsck
275will print a description of the problem and then exit with the value 4
276logically or'ed into the exit code. (See the \fBEXIT CODE\fR section.)
277This option is normally used by the system's boot scripts. It may not
278be specified at the same time as the
279.B \-n
280or
281.B \-y
282options.
Theodore Ts'of3db3561997-04-26 13:34:30 +0000283.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000284.B \-r
Theodore Ts'of3db3561997-04-26 13:34:30 +0000285This option does nothing at all; it is provided only for backwards
286compatibility.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000287.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000288.B \-t
Theodore Ts'o3839e651997-04-26 13:21:57 +0000289Print timing statistics for
290.BR e2fsck .
291If this option is used twice, additional timing statistics are printed
292on a pass by pass basis.
293.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000294.B \-v
Theodore Ts'o3839e651997-04-26 13:21:57 +0000295Verbose mode.
296.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000297.B \-V
Theodore Ts'o3839e651997-04-26 13:21:57 +0000298Print version information and exit.
299.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000300.B \-y
301Assume an answer of `yes' to all questions; allows
Theodore Ts'o3839e651997-04-26 13:21:57 +0000302.B e2fsck
Theodore Ts'o84d35182005-12-09 17:28:56 -0500303to be used non-interactively. This option
304may not be specified at the same time as the
305.B \-n
306or
307.B \-p
308options.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000309.SH EXIT CODE
310The exit code returned by
311.B e2fsck
312is the sum of the following conditions:
313.br
314\ 0\ \-\ No errors
315.br
316\ 1\ \-\ File system errors corrected
317.br
318\ 2\ \-\ File system errors corrected, system should
319.br
Theodore Ts'o4cae0452002-07-21 14:14:03 -0400320\ \ \ \ be rebooted
Theodore Ts'o3839e651997-04-26 13:21:57 +0000321.br
322\ 4\ \-\ File system errors left uncorrected
323.br
324\ 8\ \-\ Operational error
325.br
326\ 16\ \-\ Usage or syntax error
327.br
Theodore Ts'o4cae0452002-07-21 14:14:03 -0400328\ 32\ \-\ E2fsck canceled by user request
329.br
Theodore Ts'o3839e651997-04-26 13:21:57 +0000330\ 128\ \-\ Shared library error
331.br
Theodore Ts'o5596def1999-07-19 15:27:37 +0000332.SH SIGNALS
333The following signals have the following effect when sent to
334.BR e2fsck .
335.TP
336.B SIGUSR1
337This signal causes
338.B e2fsck
Theodore Ts'obe625232008-03-26 08:26:01 -0400339to start displaying a completion bar or emitting progress information.
340(See discussion of the
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000341.B \-C
Theodore Ts'o5596def1999-07-19 15:27:37 +0000342option.)
343.TP
344.B SIGUSR2
345This signal causes
346.B e2fsck
Theodore Ts'obe625232008-03-26 08:26:01 -0400347to stop displaying a completion bar or emitting progress information.
Theodore Ts'o5c576471997-04-29 15:29:49 +0000348.SH REPORTING BUGS
Theodore Ts'of3db3561997-04-26 13:34:30 +0000349Almost any piece of software will have bugs. If you manage to find a
350filesystem which causes
351.B e2fsck
352to crash, or which
353.B e2fsck
354is unable to repair, please report it to the author.
355.PP
356Please include as much information as possible in your bug report.
357Ideally, include a complete transcript of the
358.B e2fsck
Theodore Ts'o15f50512005-06-05 16:46:19 -0400359run, so I can see exactly what error messages are displayed. (Make sure
360the messages printed by
361.B e2fsck
362are in English; if your system has been
363configured so that
364.BR e2fsck 's
365messages have been translated into another language, please set the the
366.B LC_ALL
367environment variable to
368.B C
369so that the transcript of e2fsck's output will be useful to me.)
370If you
Theodore Ts'o81393672005-04-16 14:05:09 -0400371have a writable filesystem where the transcript can be stored, the
Theodore Ts'of3db3561997-04-26 13:34:30 +0000372.BR script (1)
373program is a handy way to save the output of
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000374.B e2fsck
Theodore Ts'of3db3561997-04-26 13:34:30 +0000375to a file.
376.PP
377It is also useful to send the output of
378.BR dumpe2fs (8).
379If a specific inode or inodes seems to be giving
380.B e2fsck
381trouble, try running the
382.BR debugfs (8)
383command and send the output of the
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000384.BR stat (1u)
385command run on the relevant inode(s). If the inode is a directory, the
386.B debugfs
Theodore Ts'of3db3561997-04-26 13:34:30 +0000387.I dump
388command will allow you to extract the contents of the directory inode,
389which can sent to me after being first run through
Theodore Ts'o15f50512005-06-05 16:46:19 -0400390.BR uuencode (1).
391The most useful data you can send to help reproduce
Theodore Ts'o9447f382006-05-22 17:59:37 -0400392the bug is a compressed raw image dump of the filesystem, generated using
Theodore Ts'o15f50512005-06-05 16:46:19 -0400393.BR e2image (8).
394See the
395.BR e2image (8)
396man page for more details.
Theodore Ts'of3db3561997-04-26 13:34:30 +0000397.PP
398Always include the full version string which
399.B e2fsck
400displays when it is run, so I know which version you are running.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000401.SH AUTHOR
402This version of
403.B e2fsck
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000404was written by Theodore Ts'o <tytso@mit.edu>.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000405.SH SEE ALSO
Theodore Ts'o93298662008-06-18 11:27:21 -0400406.BR e2fsck.conf (5),
Theodore Ts'ocd848232006-03-27 12:10:07 -0500407.BR badblocks (8),
Theodore Ts'of3db3561997-04-26 13:34:30 +0000408.BR dumpe2fs (8),
Theodore Ts'o15f50512005-06-05 16:46:19 -0400409.BR debugfs (8),
Theodore Ts'ocd848232006-03-27 12:10:07 -0500410.BR e2image (8),
411.BR mke2fs (8),
412.BR tune2fs (8)