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
44 is used to check the ext2/ext3/ext4 family of file systems.
45 For ext3 and ext4 filesystems that use a journal, if the system has been
46 shut down uncleanly without any errors, normally, after replaying the
47 committed transactions in the journal, the file system should be
48 marked as clean. Hence, for filesystems that use journalling,
50 will normally replay the journal and exit, unless its superblock
51 indicates that further checking is required.
54 is a block device (e.g.,
56 or file containing the file system.
58 Note that in general it is not safe to run
60 on mounted filesystems. The only exception is if the
62 option is specified, and
69 specified. However, even if it is safe to do so, the results printed by
71 are not valid if the filesystem is mounted. If
73 asks whether or not you should check a filesystem which is mounted,
74 the only correct answer is ``no''. Only experts who really know what
75 they are doing should consider answering this question in any other way.
79 is run in interactive mode (meaning that none of
84 are specified), the program will ask the user to fix each problem found in the
85 filesystem. A response of 'y' will fix the error; 'n' will leave the error
86 unfixed; and 'a' will fix the problem and all subsequent problems; pressing
87 Enter will proceed with the default response, which is printed before the
88 question mark. Pressing Control-C terminates e2fsck immediately.
92 This option does the same thing as the
94 option. It is provided for backwards compatibility only; it is
95 suggested that people use
97 option whenever possible.
100 Instead of using the normal superblock, use an alternative superblock
103 This option is normally used when the primary superblock has been
104 corrupted. The location of backup superblocks is dependent on the
105 filesystem's blocksize, the number of blocks per group, and features
109 Additional backup superblocks can be determined by using the
113 option to print out where the superblocks exist, supposing
115 is supplied with arguments that are consistent with the filesystem's layout
116 (e.g. blocksize, blocks per group,
120 If an alternative superblock is specified and
121 the filesystem is not opened read-only, e2fsck will make sure that the
122 primary superblock is updated appropriately upon completion of the
128 will search for the superblock at various different
129 block sizes in an attempt to find the appropriate block size.
130 This search can be fooled in some cases. This option forces
132 to only try locating the superblock at a particular blocksize.
133 If the superblock is not found,
135 will terminate with a fatal error.
142 program to do a read-only scan of the device in order to find any bad
143 blocks. If any bad blocks are found, they are added to the bad block
144 inode to prevent them from being allocated to a file or directory. If
145 this option is specified twice, then the bad block scan will be done
146 using a non-destructive read-write test.
151 to write completion information to the specified file descriptor
152 so that the progress of the filesystem
153 check can be monitored. This option is typically used by programs
156 If the file descriptor number is negative, then absolute value of
157 the file descriptor will be used, and the progress information will be
158 suppressed initially. It can later be enabled by sending the
160 process a SIGUSR1 signal.
161 If the file descriptor specified is 0,
163 will print a completion bar as it goes about its business. This requires
164 that e2fsck is running on a video console or terminal.
167 Print debugging output (useless unless you are debugging
171 Optimize directories in filesystem. This option causes e2fsck to
172 try to optimize all directories, either by reindexing them if the
173 filesystem supports directory indexing, or by sorting and compressing
174 directories for smaller directories, or for filesystems using
175 traditional linear directories.
181 may sometimes optimize a few directories --- for example, if
182 directory indexing is enabled and a directory is not indexed and would
183 benefit from being indexed, or if the index structures are corrupted
184 and need to be rebuilt. The
186 option forces all directories in the filesystem to be optimized. This can
187 sometimes make them a little smaller and slightly faster to search, but
188 in practice, you should rarely need to use this option.
192 option will detect directory entries with duplicate names in a single
193 directory, which e2fsck normally does not enforce for performance reasons.
195 .BI \-E " extended_options"
196 Set e2fsck extended options. Extended options are comma
197 separated, and may take an argument using the equals ('=') sign. The
198 following options are supported:
202 Resolve files with shared blocks in pass 1D by giving each file a private
203 copy of the blocks (dup);
204 or replacing the shared blocks with private, zero-filled blocks (zero).
207 .BI shared= preserve|lost+found|delete
208 Files with shared blocks discovered in pass 1D are cloned and then left
210 cloned and then disconnected from their parent directory,
211 then reconnected to /lost+found in pass 3 (lost+found);
212 or simply deleted (delete). The default is preserve.
214 .BI ea_ver= extended_attribute_version
215 Set the version of the extended attribute blocks which
217 will require while checking the filesystem. The version number may
218 be 1 or 2. The default extended attribute version format is 2.
221 Only replay the journal if required, but do not perform any further checks
224 .BI inode_badness_threshold= threshold_value
225 A badness counter is associated with every inode, which determines the degree
226 of inode corruption. Each error found in the inode will increase the badness
227 by 1 or 2, and inodes with a badness at or above
229 will be prompted for deletion. The default
231 is 12, and must either be 0 (disabled), or between 3 and 200, as some valid
232 inode states may set a badness of 1 or 2 that should not clear the inode.
235 During pass 1, print a detailed report of any discontiguous blocks for
236 files in the filesystem.
239 Attempt to discard free blocks and unused inode blocks after the full
240 filesystem check (discarding blocks is useful on solid state devices and sparse
241 / thin-provisioned storage). Note that discard is done in pass 5 AFTER the
242 filesystem has been fully checked and only if it does not contain recognizable
243 errors. However there might be cases where
245 does not fully recognize a problem and hence in this case this
246 option may prevent you from further manual data recovery.
249 Do not attempt to discard free blocks and unused inode blocks. This option is
250 exactly the opposite of discard option. This is set as default.
252 .BI no_optimize_extents
253 Do not offer to optimize the extent tree by eliminating unnecessary
254 width or depth. This can also be enabled in the options section of
255 .BR /etc/e2fsck.conf .
258 Offer to optimize the extent tree by eliminating unnecessary
259 width or depth. This is the default unless otherwise specified in
260 .BR /etc/e2fsck.conf .
262 .BI inode_count_fullmap
263 Trade off using memory for speed when checking a file system with a
264 large number of hard-linked files. The amount of memory required is
265 proportional to the number of inodes in the file system. For large file
266 systems, this can be gigabytes of memory. (For example, a 40TB file system
267 with 2.8 billion inodes will consume an additional 5.7 GB memory if this
268 optimization is enabled.) This optimization can also be enabled in the
270 .BR /etc/e2fsck.conf .
272 .BI no_inode_count_fullmap
274 .B inode_count_fullmap
275 optimization. This is the default unless otherwise specified in
276 .BR /etc/e2fsck.conf .
279 Use this many KiB of memory to pre-fetch metadata in the hopes of reducing
280 e2fsck runtime. By default, this is set to the size of two block groups' inode
281 tables (typically 4MiB on a regular ext4 filesystem); if this amount is more
282 than 1/50th of total physical memory, readahead is disabled. Set this to zero
283 to disable readahead entirely.
286 Convert block-mapped files to extent-mapped files.
289 Only fix damaged metadata; do not optimize htree directories or compress
290 extent trees. This option is incompatible with the -D and -E bmap2extent
294 Force verification of encoded filenames in case-insensitive directories.
295 This is the default mode if the filesystem has the strict flag enabled.
298 If the filesystem has shared blocks, with the shared blocks read-only feature
299 enabled, then this will unshare all shared blocks and unset the read-only
300 feature bit. If there is not enough free space then the operation will fail.
301 If the filesystem does not have the read-only feature bit, but has shared
302 blocks anyway, then this option will have no effect. Note when using this
303 option, if there is no free space to clone blocks, there is no prompt to
304 delete files and instead the operation will fail.
306 Note that unshare_blocks implies the "-f" option to ensure that all passes
307 are run. Additionally, if "-n" is also specified, e2fsck will simulate trying
308 to allocate enough space to deduplicate. If this fails, the exit code will
313 Force checking even if the file system seems clean.
316 Flush the filesystem device's buffer caches before beginning. Only
317 really useful for doing
321 @JDEV@.BI \-j " external-journal"
322 @JDEV@Set the pathname where the external-journal for this filesystem can be
326 When combined with the
328 option, any existing bad blocks in the bad blocks list are preserved,
329 and any new bad blocks found by running
331 will be added to the existing bad blocks list.
334 Add the block numbers listed in the file specified by
336 to the list of bad blocks. The format of this file is the same as the
339 program. Note that the block numbers are based on the blocksize
340 of the filesystem. Hence,
342 must be given the blocksize of the filesystem in order to obtain correct
343 results. As a result, it is much simpler and safer to use the
347 since it will assure that the correct parameters are passed to the
352 Set the bad blocks list to be the list of blocks specified by
354 (This option is the same as the
356 option, except the bad blocks list is cleared before the blocks listed
357 in the file are added to the bad blocks list.)
360 Run e2fsck with up to the specified number of
362 The actual number of threads may be lower, if the filesystem does not
363 have enough block groups to effectively parallelize the workload.
366 Open the filesystem read-only, and assume an answer of `no' to all
369 to be used non-interactively. This option
370 may not be specified at the same time as the
377 Automatically repair ("preen") the file system. This option will cause
380 fix any filesystem problems that can be safely fixed without human
383 discovers a problem which may require the system administrator
384 to take additional corrective action,
386 will print a description of the problem and then exit with the value 4
387 logically or'ed into the exit code. (See the \fBEXIT CODE\fR section.)
388 This option is normally used by the system's boot scripts. It may not
389 be specified at the same time as the
396 This option does nothing at all; it is provided only for backwards
400 Print timing statistics for
402 If this option is used twice, additional timing statistics are printed
403 on a pass by pass basis.
409 Print version information and exit.
412 Assume an answer of `yes' to all questions; allows
414 to be used non-interactively. This option
415 may not be specified at the same time as the
422 Before overwriting a file system block, write the old contents of the block to
423 an undo file. This undo file can be used with e2undo(8) to restore the old
424 contents of the file system should something go wrong. If the empty string is
425 passed as the undo_file argument, the undo file will be written to a file named
426 e2fsck-\fIdevice\fR.e2undo in the directory specified via the
427 \fIE2FSPROGS_UNDO_DIR\fR environment variable.
429 WARNING: The undo file cannot be used to recover from a power or system crash.
431 The exit code returned by
433 is the sum of the following conditions:
437 \ 1\ \-\ File system errors corrected
439 \ 2\ \-\ File system errors corrected, system should
443 \ 4\ \-\ File system errors left uncorrected
445 \ 8\ \-\ Operational error
447 \ 16\ \-\ Usage or syntax error
449 \ 32\ \-\ E2fsck canceled by user request
451 \ 128\ \-\ Shared library error
454 The following signals have the following effect when sent to
460 to start displaying a completion bar or emitting progress information.
461 (See discussion of the
468 to stop displaying a completion bar or emitting progress information.
470 Almost any piece of software will have bugs. If you manage to find a
471 filesystem which causes
475 is unable to repair, please report it to the author.
477 Please include as much information as possible in your bug report.
478 Ideally, include a complete transcript of the
480 run, so I can see exactly what error messages are displayed. (Make sure
481 the messages printed by
483 are in English; if your system has been
486 messages have been translated into another language, please set the the
488 environment variable to
490 so that the transcript of e2fsck's output will be useful to me.)
492 have a writable filesystem where the transcript can be stored, the
494 program is a handy way to save the output of
498 It is also useful to send the output of
500 If a specific inode or inodes seems to be giving
502 trouble, try running the
504 command and send the output of the
506 command run on the relevant inode(s). If the inode is a directory, the
509 command will allow you to extract the contents of the directory inode,
510 which can sent to me after being first run through
512 The most useful data you can send to help reproduce
513 the bug is a compressed raw image dump of the filesystem, generated using
517 man page for more details.
519 Always include the full version string which
521 displays when it is run, so I know which version you are running.
525 Determines the location of the configuration file (see
526 .BR e2fsck.conf (5)).
530 was written by Theodore Ts'o <tytso@mit.edu>.