blob: eb560bf0c7172b382e379766911ff6000dcdbcae [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 .
142If the file descriptor specified is 0,
Theodore Ts'oefac9a11998-05-07 05:02:00 +0000143.B e2fsck
Theodore Ts'o5596def1999-07-19 15:27:37 +0000144will print a completion bar as it goes about its business. This requires
145that e2fsck is running on a video console or terminal.
Theodore Ts'oefac9a11998-05-07 05:02:00 +0000146.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000147.B \-d
Theodore Ts'o3839e651997-04-26 13:21:57 +0000148Print debugging output (useless unless you are debugging
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000149.BR e2fsck ).
Theodore Ts'o3839e651997-04-26 13:21:57 +0000150.TP
Theodore Ts'o850d05e2002-07-25 00:00:08 -0400151.B \-D
152Optimize directories in filesystem. This option causes e2fsck to
153try to optimize all directories, either by reindexing them if the
154filesystem supports directory indexing, or by sorting and compressing
155directories for smaller directories, or for filesystems using
156traditional linear directories.
157.TP
Theodore Ts'o0684a4f2002-08-17 10:19:44 -0400158.BI \-E " extended_options"
159Set e2fsck extended options. Extended options are comma
160separated, and may take an argument using the equals ('=') sign. The
161following options are supported:
162.RS 1.2i
163.TP
164.BI ea_ver= extended_attribute_version
165Assume the format of the extended attribute blocks in the filesystem is
166the specified version number. The version number may be 1 or 2. The
167default extended attribute version format is 2.
168.RE
169.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000170.B \-f
Theodore Ts'o3839e651997-04-26 13:21:57 +0000171Force checking even if the file system seems clean.
172.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000173.B \-F
Theodore Ts'o3839e651997-04-26 13:21:57 +0000174Flush the filesystem device's buffer caches before beginning. Only
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000175really useful for doing
176.B e2fsck
177time trials.
Theodore Ts'oadee8d72001-07-23 00:17:49 -0400178@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.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000182.TP
Theodore Ts'o4fb9d522004-02-24 00:16:09 -0500183.BI \-k
184When combined with the
185.B \-c
186option, any existing bad blocks in the bad blocks list are preserved,
187and any new bad blocks found by running
188.BR badblocks (8)
189will be added to the existing bad blocks list.
190.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000191.BI \-l " filename"
Theodore Ts'o3ed57c22001-12-24 15:01:59 -0500192Add the block numbers listed in the file specified by
Theodore Ts'o3839e651997-04-26 13:21:57 +0000193.I filename
Theodore Ts'o43139321998-02-16 22:34:46 +0000194to the list of bad blocks. The format of this file is the same as the
195one generated by the
196.BR badblocks (8)
Theodore Ts'o3ed57c22001-12-24 15:01:59 -0500197program. Note that the block numbers are based on the blocksize
198of the filesystem. Hence,
199.BR badblocks (8)
200must be given the blocksize of the filesystem in order to obtain correct
201results. As a result, it is much simpler and safer to use the
202.B -c
203option to
204.BR e2fsck ,
205since it will assure that the correct parameters are passed to the
206.B badblocks
Theodore Ts'o43139321998-02-16 22:34:46 +0000207program.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000208.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000209.BI \-L " filename"
Theodore Ts'o3839e651997-04-26 13:21:57 +0000210Set the bad blocks list to be the list of blocks specified by
211.IR filename .
212(This option is the same as the
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000213.B \-l
Theodore Ts'o3839e651997-04-26 13:21:57 +0000214option, except the bad blocks list is cleared before the blocks listed
215in the file are added to the bad blocks list.)
216.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000217.B \-n
218Open the filesystem read-only, and assume an answer of `no' to all
Theodore Ts'o3839e651997-04-26 13:21:57 +0000219questions. Allows
220.B e2fsck
221to be used non-interactively. (Note: if the
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000222.BR \-c ,
223.BR \-l ,
Theodore Ts'o3839e651997-04-26 13:21:57 +0000224or
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000225.B \-L
Theodore Ts'o3839e651997-04-26 13:21:57 +0000226options are specified in addition to the
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000227.B \-n
Theodore Ts'o3839e651997-04-26 13:21:57 +0000228option, then the filesystem will be opened read-write, to permit the
229bad-blocks list to be updated. However, no other changes will be made
Theodore Ts'o84d35182005-12-09 17:28:56 -0500230to the filesystem.) This option
231may not be specified at the same time as the
232.B \-p
233or
234.B \-y
235options.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000236.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000237.B \-p
Theodore Ts'o84d35182005-12-09 17:28:56 -0500238Automatically repair ("preen") the file system. This option will case
239.B e2fsck
240to automatically
241fix any filesystem problems that can be safely fixed without human
242intervention. If
243.B e2fsck
244discovers a problem which may require the system administrator
245to take additional corrective action,
246.B e2fsck
247will print a description of the problem and then exit with the value 4
248logically or'ed into the exit code. (See the \fBEXIT CODE\fR section.)
249This option is normally used by the system's boot scripts. It may not
250be specified at the same time as the
251.B \-n
252or
253.B \-y
254options.
Theodore Ts'of3db3561997-04-26 13:34:30 +0000255.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000256.B \-r
Theodore Ts'of3db3561997-04-26 13:34:30 +0000257This option does nothing at all; it is provided only for backwards
258compatibility.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000259.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000260.B \-t
Theodore Ts'o3839e651997-04-26 13:21:57 +0000261Print timing statistics for
262.BR e2fsck .
263If this option is used twice, additional timing statistics are printed
264on a pass by pass basis.
265.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000266.B \-v
Theodore Ts'o3839e651997-04-26 13:21:57 +0000267Verbose mode.
268.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000269.B \-V
Theodore Ts'o3839e651997-04-26 13:21:57 +0000270Print version information and exit.
271.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000272.B \-y
273Assume an answer of `yes' to all questions; allows
Theodore Ts'o3839e651997-04-26 13:21:57 +0000274.B e2fsck
Theodore Ts'o84d35182005-12-09 17:28:56 -0500275to be used non-interactively. This option
276may not be specified at the same time as the
277.B \-n
278or
279.B \-p
280options.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000281.SH EXIT CODE
282The exit code returned by
283.B e2fsck
284is the sum of the following conditions:
285.br
286\ 0\ \-\ No errors
287.br
288\ 1\ \-\ File system errors corrected
289.br
290\ 2\ \-\ File system errors corrected, system should
291.br
Theodore Ts'o4cae0452002-07-21 14:14:03 -0400292\ \ \ \ be rebooted
Theodore Ts'o3839e651997-04-26 13:21:57 +0000293.br
294\ 4\ \-\ File system errors left uncorrected
295.br
296\ 8\ \-\ Operational error
297.br
298\ 16\ \-\ Usage or syntax error
299.br
Theodore Ts'o4cae0452002-07-21 14:14:03 -0400300\ 32\ \-\ E2fsck canceled by user request
301.br
Theodore Ts'o3839e651997-04-26 13:21:57 +0000302\ 128\ \-\ Shared library error
303.br
Theodore Ts'o5596def1999-07-19 15:27:37 +0000304.SH SIGNALS
305The following signals have the following effect when sent to
306.BR e2fsck .
307.TP
308.B SIGUSR1
309This signal causes
310.B e2fsck
311to start displaying a completion bar. (See discussion of the
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +0000312.B \-C
Theodore Ts'o5596def1999-07-19 15:27:37 +0000313option.)
314.TP
315.B SIGUSR2
316This signal causes
317.B e2fsck
318to stop displaying a completion bar.
Theodore Ts'o5c576471997-04-29 15:29:49 +0000319.SH REPORTING BUGS
Theodore Ts'of3db3561997-04-26 13:34:30 +0000320Almost any piece of software will have bugs. If you manage to find a
321filesystem which causes
322.B e2fsck
323to crash, or which
324.B e2fsck
325is unable to repair, please report it to the author.
326.PP
327Please include as much information as possible in your bug report.
328Ideally, include a complete transcript of the
329.B e2fsck
Theodore Ts'o15f50512005-06-05 16:46:19 -0400330run, so I can see exactly what error messages are displayed. (Make sure
331the messages printed by
332.B e2fsck
333are in English; if your system has been
334configured so that
335.BR e2fsck 's
336messages have been translated into another language, please set the the
337.B LC_ALL
338environment variable to
339.B C
340so that the transcript of e2fsck's output will be useful to me.)
341If you
Theodore Ts'o81393672005-04-16 14:05:09 -0400342have a writable filesystem where the transcript can be stored, the
Theodore Ts'of3db3561997-04-26 13:34:30 +0000343.BR script (1)
344program is a handy way to save the output of
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000345.B e2fsck
Theodore Ts'of3db3561997-04-26 13:34:30 +0000346to a file.
347.PP
348It is also useful to send the output of
349.BR dumpe2fs (8).
350If a specific inode or inodes seems to be giving
351.B e2fsck
352trouble, try running the
353.BR debugfs (8)
354command and send the output of the
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000355.BR stat (1u)
356command run on the relevant inode(s). If the inode is a directory, the
357.B debugfs
Theodore Ts'of3db3561997-04-26 13:34:30 +0000358.I dump
359command will allow you to extract the contents of the directory inode,
360which can sent to me after being first run through
Theodore Ts'o15f50512005-06-05 16:46:19 -0400361.BR uuencode (1).
362The most useful data you can send to help reproduce
Theodore Ts'o9447f382006-05-22 17:59:37 -0400363the bug is a compressed raw image dump of the filesystem, generated using
Theodore Ts'o15f50512005-06-05 16:46:19 -0400364.BR e2image (8).
365See the
366.BR e2image (8)
367man page for more details.
Theodore Ts'of3db3561997-04-26 13:34:30 +0000368.PP
369Always include the full version string which
370.B e2fsck
371displays when it is run, so I know which version you are running.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000372.SH AUTHOR
373This version of
374.B e2fsck
Theodore Ts'o583ccdc1997-05-09 03:06:31 +0000375was written by Theodore Ts'o <tytso@mit.edu>.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000376.SH SEE ALSO
Theodore Ts'ocd848232006-03-27 12:10:07 -0500377.BR badblocks (8),
Theodore Ts'of3db3561997-04-26 13:34:30 +0000378.BR dumpe2fs (8),
Theodore Ts'o15f50512005-06-05 16:46:19 -0400379.BR debugfs (8),
Theodore Ts'ocd848232006-03-27 12:10:07 -0500380.BR e2image (8),
381.BR mke2fs (8),
382.BR tune2fs (8)