1E2FSCK(8)                   System Manager's Manual                  E2FSCK(8)
2
3
4

NAME

6       e2fsck - check a Linux ext2/ext3/ext4 file system
7

SYNOPSIS

9       e2fsck  [  -pacnyrdfkvtDFV ] [ -b superblock ] [ -B blocksize ] [ -l|-L
10       bad_blocks_file  ]  [  -C  fd  ]  [  -j   external-journal   ]   [   -E
11       extended_options ] device
12

DESCRIPTION

14       e2fsck is used to check the ext2/ext3/ext4 family of file systems.  For
15       ext3 and ext4 filesystems that use a journal, if the  system  has  been
16       shut  down  uncleanly without any errors, normally, after replaying the
17       committed transactions  in the  journal,  the  file  system  should  be
18       marked  as clean.   Hence, for filesystems that use journalling, e2fsck
19       will normally replay the journal and exit, unless its superblock  indi‐
20       cates that further checking is required.
21
22       device  is  the  device  file  where  the  filesystem  is  stored (e.g.
23       /dev/hdc1).
24
25       Note that in general it is not safe to run e2fsck on  mounted  filesys‐
26       tems.  The only exception is if the -n option is specified, and -c, -l,
27       or -L options are not specified.   However, even if it is  safe  to  do
28       so,  the  results  printed by e2fsck are not valid if the filesystem is
29       mounted.   If e2fsck asks whether or not you should check a  filesystem
30       which  is mounted, the only correct answer is ``no''.  Only experts who
31       really know what they are doing should consider answering this question
32       in any other way.
33

OPTIONS

35       -a     This  option  does  the same thing as the -p option.  It is pro‐
36              vided for backwards compatibility only;  it  is  suggested  that
37              people use -p option whenever possible.
38
39       -b superblock
40              Instead  of  using  the  normal  superblock,  use an alternative
41              superblock specified by superblock.   This  option  is  normally
42              used  when the primary superblock has been corrupted.  The loca‐
43              tion of the backup superblock is dependent on  the  filesystem's
44              blocksize.    For  filesystems  with  1k  blocksizes,  a  backup
45              superblock can be found at block 8193; for filesystems  with  2k
46              blocksizes,  at  block  16384;  and  for 4k blocksizes, at block
47              32768.
48
49              Additional backup superblocks can be  determined  by  using  the
50              mke2fs  program  using  the  -n  option  to  print out where the
51              superblocks were created.   The -b option to mke2fs, which spec‐
52              ifies blocksize of the filesystem must be specified in order for
53              the superblock locations that are printed out to be accurate.
54
55              If an alternative superblock is specified and the filesystem  is
56              not  opened  read-only,  e2fsck  will make sure that the primary
57              superblock is  updated  appropriately  upon  completion  of  the
58              filesystem check.
59
60       -B blocksize
61              Normally,  e2fsck will search for the superblock at various dif‐
62              ferent block sizes in an attempt to find the  appropriate  block
63              size.   This  search  can  be fooled in some cases.  This option
64              forces e2fsck to only try locating the superblock at a  particu‐
65              lar blocksize.  If the superblock is not found, e2fsck will ter‐
66              minate with a fatal error.
67
68       -c     This option causes e2fsck to use badblocks(8) program  to  do  a
69              read-only  scan  of  the device in order to find any bad blocks.
70              If any bad blocks are found, they are added  to  the  bad  block
71              inode  to  prevent them from being allocated to a file or direc‐
72              tory.  If this option is specified twice,  then  the  bad  block
73              scan will be done using a non-destructive read-write test.
74
75       -C fd  This option causes e2fsck to write completion information to the
76              specified file descriptor so that the progress of the filesystem
77              check  can  be monitored.  This option is typically used by pro‐
78              grams which are running e2fsck.  If the file  descriptor  number
79              is  negative, then absolute value of the file descriptor will be
80              used, and the progress information will be suppressed initially.
81              It  can later be enabled by sending the e2fsck process a SIGUSR1
82              signal.  If the file descriptor  specified  is  0,  e2fsck  will
83              print  a  completion  bar  as  it goes about its business.  This
84              requires that e2fsck is running on a video console or terminal.
85
86       -d     Print  debugging  output  (useless  unless  you  are   debugging
87              e2fsck).
88
89       -D     Optimize  directories  in filesystem.  This option causes e2fsck
90              to try to optimize all directories, either by reindexing them if
91              the  filesystem  supports directory indexing,  or by sorting and
92              compressing directories for smaller directories, or for filesys‐
93              tems using traditional linear directories.
94
95              Even  without the -D option, e2fsck may sometimes optimize a few
96              directories --- for example, if directory  indexing  is  enabled
97              and  a  directory  is  not  indexed and would benefit from being
98              indexed, or if the index structures are corrupted and need to be
99              rebuilt.  The -D option forces all directories in the filesystem
100              to be optimized.  This can sometimes make them a little  smaller
101              and  slightly  faster  to  search,  but  in practice, you should
102              rarely need to use this option.
103
104              The -D option will detect directory entries with duplicate names
105              in  a  single  directory, which e2fsck normally does not enforce
106              for performance reasons.
107
108       -E extended_options
109              Set e2fsck extended options.  Extended options are  comma  sepa‐
110              rated,  and  may  take  an argument using the equals ('=') sign.
111              The following options are supported:
112
113                   ea_ver=extended_attribute_version
114                          Set the version of  the  extended  attribute  blocks
115                          which   e2fsck   will  require  while  checking  the
116                          filesystem.  The version number may be 1 or 2.   The
117                          default extended attribute version format is 2.
118
119                   journal_only
120                          Only replay the journal if required, but do not per‐
121                          form any further checks or repairs.
122
123                   fragcheck
124                          During pass 1, print a detailed report of  any  dis‐
125                          contiguous blocks for files in the filesystem.
126
127                   discard
128                          Attempt  to  discard  free  blocks  and unused inode
129                          blocks after the full filesystem  check  (discarding
130                          blocks is useful on solid state devices and sparse /
131                          thin-provisioned storage). Note that discard is done
132                          in  pass  5  AFTER  the  filesystem  has  been fully
133                          checked and only if it does not contain recognizable
134                          errors.  However  there  might be cases where e2fsck
135                          does not fully recognize a problem and hence in this
136                          case this option may prevent you from further manual
137                          data recovery.
138
139                   nodiscard
140                          Do not attempt to discard  free  blocks  and  unused
141                          inode blocks. This option is exactly the opposite of
142                          discard option. This is set as default.
143
144       -f     Force checking even if the file system seems clean.
145
146       -F     Flush the filesystem device's buffer  caches  before  beginning.
147              Only really useful for doing e2fsck time trials.
148
149       -j external-journal
150              Set  the pathname where the external-journal for this filesystem
151              can be found.
152
153       -k     When combined with the -c option, any existing bad blocks in the
154              bad  blocks  list are preserved, and any new bad blocks found by
155              running badblocks(8) will be added to the  existing  bad  blocks
156              list.
157
158       -l filename
159              Add  the  block numbers listed in the file specified by filename
160              to the list of bad blocks.  The format of this file is the  same
161              as the one generated by the badblocks(8) program.  Note that the
162              block numbers are based on  the  blocksize  of  the  filesystem.
163              Hence,  badblocks(8) must be given the blocksize of the filesys‐
164              tem in order to obtain correct results.  As a result, it is much
165              simpler  and safer to use the -c option to e2fsck, since it will
166              assure that the correct parameters are passed to  the  badblocks
167              program.
168
169       -L filename
170              Set  the  bad  blocks list to be the list of blocks specified by
171              filename.  (This option is the same as the -l option, except the
172              bad  blocks list is cleared before the blocks listed in the file
173              are added to the bad blocks list.)
174
175       -n     Open the filesystem read-only, and assume an answer of  `no'  to
176              all  questions.   Allows  e2fsck  to  be used non-interactively.
177              This option may not be specified at the same time as the  -p  or
178              -y options.
179
180       -p     Automatically  repair  ("preen")  the  file system.  This option
181              will cause e2fsck to automatically fix any  filesystem  problems
182              that  can be safely fixed without human intervention.  If e2fsck
183              discovers a problem which may require the  system  administrator
184              to  take  additional  corrective  action,  e2fsck  will  print a
185              description of the problem and then exit with the value 4  logi‐
186              cally  or'ed  into  the exit code.  (See the EXIT CODE section.)
187              This option is normally used by the system's boot  scripts.   It
188              may not be specified at the same time as the -n or -y options.
189
190       -r     This  option  does nothing at all; it is provided only for back‐
191              wards compatibility.
192
193       -t     Print timing statistics for e2fsck.   If  this  option  is  used
194              twice,  additional  timing  statistics  are printed on a pass by
195              pass basis.
196
197       -v     Verbose mode.
198
199       -V     Print version information and exit.
200
201       -y     Assume an answer of `yes' to all questions; allows e2fsck to  be
202              used non-interactively.  This option may not be specified at the
203              same time as the -n or -p options.
204

EXIT CODE

206       The exit code returned by e2fsck is the sum  of  the  following  condi‐
207       tions:
208            0    - No errors
209            1    - File system errors corrected
210            2    - File system errors corrected, system should
211                   be rebooted
212            4    - File system errors left uncorrected
213            8    - Operational error
214            16   - Usage or syntax error
215            32   - E2fsck canceled by user request
216            128  - Shared library error
217

SIGNALS

219       The following signals have the following effect when sent to e2fsck.
220
221       SIGUSR1
222              This  signal  causes e2fsck to start displaying a completion bar
223              or emitting progress information.  (See  discussion  of  the  -C
224              option.)
225
226       SIGUSR2
227              This signal causes e2fsck to stop displaying a completion bar or
228              emitting progress information.
229

REPORTING BUGS

231       Almost any piece of software will have bugs.  If you manage to  find  a
232       filesystem  which  causes e2fsck to crash, or which e2fsck is unable to
233       repair, please report it to the author.
234
235       Please include as much information as  possible  in  your  bug  report.
236       Ideally,  include a complete transcript of the e2fsck run, so I can see
237       exactly what error messages are displayed.   (Make  sure  the  messages
238       printed by e2fsck are in English; if your system has been configured so
239       that e2fsck's messages have  been  translated  into  another  language,
240       please  set  the the LC_ALL environment variable to C so that the tran‐
241       script of e2fsck's output will  be  useful  to  me.)   If  you  have  a
242       writable  filesystem  where the transcript can be stored, the script(1)
243       program is a handy way to save the output of e2fsck to a file.
244
245       It is also useful to send the output of  dumpe2fs(8).   If  a  specific
246       inode  or  inodes  seems  to  be giving e2fsck trouble, try running the
247       debugfs(8) command and send the output of the stat(1u) command  run  on
248       the  relevant  inode(s).  If the inode is a directory, the debugfs dump
249       command will allow you to extract the contents of the directory  inode,
250       which  can  sent  to me after being first run through uuencode(1).  The
251       most useful data you can send to help reproduce the bug is a compressed
252       raw  image dump of the filesystem, generated using e2image(8).  See the
253       e2image(8) man page for more details.
254
255       Always include the full version string which e2fsck displays when it is
256       run, so I know which version you are running.
257

AUTHOR

259       This version of e2fsck was written by Theodore Ts'o <tytso@mit.edu>.
260

SEE ALSO

262       e2fsck.conf(5),   badblocks(8),  dumpe2fs(8),  debugfs(8),  e2image(8),
263       mke2fs(8), tune2fs(8)
264
265
266
267E2fsprogs version 1.42.9         December 2013                       E2FSCK(8)
Impressum