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.
5 .TH E2FSCK 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
7 e2fsck \- check a Linux ext2/ext3/ext4 file system
31 @JDEV@.I external-journal
40 is used to check the ext2/ext3/ext4 family of file systems.
41 For ext3 and ext4 filesystems that use a journal, if the system has been
42 shut down uncleanly without any errors, normally, after replaying the
43 committed transactions in the journal, the file system should be
44 marked as clean. Hence, for filesystems that use journalling,
46 will normally replay the journal and exit, unless its superblock
47 indicates that further checking is required.
50 is the device file where the filesystem is stored (e.g.
53 Note that in general it is not safe to run
55 on mounted filesystems. The only exception is if the
57 option is specified, and
64 specified. However, even if it is safe to do so, the results printed by
66 are not valid if the filesystem is mounted. If
68 asks whether or not you should check a filesystem which is mounted,
69 the only correct answer is ``no''. Only experts who really know what
70 they are doing should consider answering this question in any other way.
74 This option does the same thing as the
76 option. It is provided for backwards compatibility only; it is
77 suggested that people use
79 option whenever possible.
82 Instead of using the normal superblock, use an alternative superblock
85 This option is normally used when the primary superblock has been
86 corrupted. The location of the backup superblock is dependent on the
87 filesystem's blocksize. For filesystems with 1k blocksizes, a backup
88 superblock can be found at block 8193; for filesystems with 2k
89 blocksizes, at block 16384; and for 4k blocksizes, at block 32768.
91 Additional backup superblocks can be determined by using the
95 option to print out where the superblocks were created. The
99 which specifies blocksize of the filesystem must be specified in order
100 for the superblock locations that are printed out to be accurate.
102 If an alternative superblock is specified and
103 the filesystem is not opened read-only, e2fsck will make sure that the
104 primary superblock is updated appropriately upon completion of the
110 will search for the superblock at various different
111 block sizes in an attempt to find the appropriate block size.
112 This search can be fooled in some cases. This option forces
114 to only try locating the superblock at a particular blocksize.
115 If the superblock is not found,
117 will terminate with a fatal error.
124 program to do a read-only scan of the device in order to find any bad
125 blocks. If any bad blocks are found, they are added to the bad block
126 inode to prevent them from being allocated to a file or directory. If
127 this option is specified twice, then the bad block scan will be done
128 using a non-destructive read-write test.
133 to write completion information to the specified file descriptor
134 so that the progress of the filesystem
135 check can be monitored. This option is typically used by programs
138 If the file descriptor number is negative, then absolute value of
139 the file descriptor will be used, and the progress information will be
140 suppressed initially. It can later be enabled by sending the
142 process a SIGUSR1 signal.
143 If the file descriptor specified is 0,
145 will print a completion bar as it goes about its business. This requires
146 that e2fsck is running on a video console or terminal.
149 Print debugging output (useless unless you are debugging
153 Optimize directories in filesystem. This option causes e2fsck to
154 try to optimize all directories, either by reindexing them if the
155 filesystem supports directory indexing, or by sorting and compressing
156 directories for smaller directories, or for filesystems using
157 traditional linear directories.
163 may sometimes optimize a few directories --- for example, if
164 directory indexing is enabled and a directory is not indexed and would
165 benefit from being indexed, or if the index structures are corrupted
166 and need to be rebuilt. The
168 option forces all directories in the filesystem to be optimized. This can
169 sometimes make them a little smaller and slightly faster to search, but
170 in practice, you should rarely need to use this option.
174 option will detect directory entries with duplicate names in a single
175 directory, which e2fsck normally does not enforce for performance reasons.
177 .BI \-E " extended_options"
178 Set e2fsck extended options. Extended options are comma
179 separated, and may take an argument using the equals ('=') sign. The
180 following options are supported:
184 Resolve files with shared blocks in pass 1D by giving each file a private
185 copy of the blocks (dup);
186 or replacing the shared blocks with private, zero-filled blocks (zero).
189 .BI shared= preserve|lost+found|delete
190 Files with shared blocks discovered in pass 1D are cloned and then left
192 cloned and then disconnected from their parent directory,
193 then reconnected to /lost+found in pass 3 (lost+found);
194 or simply deleted (delete). The default is preserve.
196 .BI ea_ver= extended_attribute_version
197 Set the version of the extended attribute blocks which
199 will require while checking the filesystem. The version number may
200 be 1 or 2. The default extended attribute version format is 2.
203 Only replay the journal if required, but do not perform any further checks
206 .BI inode_badness_threshold= threshold_value
207 A badness counter is associated with every inode, which determines the degree
208 of inode corruption. Each error found in the inode will increase the badness by
209 1 or 2, and inodes with a badness at or above
211 will be prompted for deletion. The default
216 During pass 1, print a detailed report of any discontiguous blocks for
217 files in the filesystem.
220 Attempt to discard free blocks and unused inode blocks after the full
221 filesystem check (discarding blocks is useful on solid state devices and sparse
222 / thin-provisioned storage). Note that discard is done in pass 5 AFTER the
223 filesystem has been fully checked and only if it does not contain recognizable
224 errors. However there might be cases where
226 does not fully recognize a problem and hence in this case this
227 option may prevent you from further manual data recovery.
230 Do not attempt to discard free blocks and unused inode blocks. This option is
231 exactly the opposite of discard option. This is set as default.
235 Force checking even if the file system seems clean.
238 Flush the filesystem device's buffer caches before beginning. Only
239 really useful for doing
243 @JDEV@.BI \-j " external-journal"
244 @JDEV@Set the pathname where the external-journal for this filesystem can be
248 When combined with the
250 option, any existing bad blocks in the bad blocks list are preserved,
251 and any new bad blocks found by running
253 will be added to the existing bad blocks list.
256 Add the block numbers listed in the file specified by
258 to the list of bad blocks. The format of this file is the same as the
261 program. Note that the block numbers are based on the blocksize
262 of the filesystem. Hence,
264 must be given the blocksize of the filesystem in order to obtain correct
265 results. As a result, it is much simpler and safer to use the
269 since it will assure that the correct parameters are passed to the
274 Set the bad blocks list to be the list of blocks specified by
276 (This option is the same as the
278 option, except the bad blocks list is cleared before the blocks listed
279 in the file are added to the bad blocks list.)
282 Open the filesystem read-only, and assume an answer of `no' to all
285 to be used non-interactively. This option
286 may not be specified at the same time as the
293 Automatically repair ("preen") the file system. This option will cause
296 fix any filesystem problems that can be safely fixed without human
299 discovers a problem which may require the system administrator
300 to take additional corrective action,
302 will print a description of the problem and then exit with the value 4
303 logically or'ed into the exit code. (See the \fBEXIT CODE\fR section.)
304 This option is normally used by the system's boot scripts. It may not
305 be specified at the same time as the
312 This option does nothing at all; it is provided only for backwards
316 Print timing statistics for
318 If this option is used twice, additional timing statistics are printed
319 on a pass by pass basis.
325 Print version information and exit.
328 Assume an answer of `yes' to all questions; allows
330 to be used non-interactively. This option
331 may not be specified at the same time as the
337 The exit code returned by
339 is the sum of the following conditions:
343 \ 1\ \-\ File system errors corrected
345 \ 2\ \-\ File system errors corrected, system should
349 \ 4\ \-\ File system errors left uncorrected
351 \ 8\ \-\ Operational error
353 \ 16\ \-\ Usage or syntax error
355 \ 32\ \-\ E2fsck canceled by user request
357 \ 128\ \-\ Shared library error
360 The following signals have the following effect when sent to
366 to start displaying a completion bar or emitting progress information.
367 (See discussion of the
374 to stop displaying a completion bar or emitting progress information.
376 Almost any piece of software will have bugs. If you manage to find a
377 filesystem which causes
381 is unable to repair, please report it to the author.
383 Please include as much information as possible in your bug report.
384 Ideally, include a complete transcript of the
386 run, so I can see exactly what error messages are displayed. (Make sure
387 the messages printed by
389 are in English; if your system has been
392 messages have been translated into another language, please set the the
394 environment variable to
396 so that the transcript of e2fsck's output will be useful to me.)
398 have a writable filesystem where the transcript can be stored, the
400 program is a handy way to save the output of
404 It is also useful to send the output of
406 If a specific inode or inodes seems to be giving
408 trouble, try running the
410 command and send the output of the
412 command run on the relevant inode(s). If the inode is a directory, the
415 command will allow you to extract the contents of the directory inode,
416 which can sent to me after being first run through
418 The most useful data you can send to help reproduce
419 the bug is a compressed raw image dump of the filesystem, generated using
423 man page for more details.
425 Always include the full version string which
427 displays when it is run, so I know which version you are running.
431 was written by Theodore Ts'o <tytso@mit.edu>.