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

NAME

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

SYNOPSIS

9       e2fsck [ -pacnyrdfkvstDFSV ] [ -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 a Linux second extended file system (ext2fs).
15       E2fsck also supports ext2 filesystems containing a journal,  which  are
16       also sometimes known as ext3 filesystems, by first applying the journal
17       to the filesystem before  continuing  with  normal  e2fsck  processing.
18       After  the  journal  has  been  applied,  a filesystem will normally be
19       marked as clean.  Hence, for ext3 filesystems, e2fsck will normally run
20       the  journal  and  exit,  unless  its superblock indicates that further
21       checking is required.
22
23       device is  the  device  file  where  the  filesystem  is  stored  (e.g.
24       /dev/hdc1).
25
26       Note  that  in general it is not safe to run e2fsck on mounted filesys‐
27       tems.  The only exception is if the -n option is specified, and -c, -l,
28       or  -L  options  are not specified.   However, even if it is safe to do
29       so, the results printed by e2fsck are not valid if  the  filesystem  is
30       mounted.    If e2fsck asks whether or not you should check a filesystem
31       which is mounted, the only correct answer is ``no''.  Only experts  who
32       really know what they are doing should consider answering this question
33       in any other way.
34

OPTIONS

36       -a     This option does the same thing as the -p option.   It  is  pro‐
37              vided  for  backwards  compatibility  only; it is suggested that
38              people use -p option whenever possible.
39
40       -b superblock
41              Instead of using  the  normal  superblock,  use  an  alternative
42              superblock  specified  by  superblock.   This option is normally
43              used when the primary superblock has been corrupted.  The  loca‐
44              tion  of  the backup superblock is dependent on the filesystem's
45              blocksize.   For  filesystems  with  1k  blocksizes,  a   backup
46              superblock  can  be found at block 8193; for filesystems with 2k
47              blocksizes, at block 16384; and  for  4k  blocksizes,  at  block
48              32768.
49
50              Additional  backup  superblocks  can  be determined by using the
51              mke2fs program using the  -n  option  to  print  out  where  the
52              superblocks were created.   The -b option to mke2fs, which spec‐
53              ifies blocksize of the filesystem must be specified in order for
54              the superblock locations that are printed out to be accurate.
55
56              If  an alternative superblock is specified and the filesystem is
57              not opened read-only, e2fsck will make  sure  that  the  primary
58              superblock  is  updated  appropriately  upon  completion  of the
59              filesystem check.
60
61       -B blocksize
62              Normally, e2fsck will search for the superblock at various  dif‐
63              ferent  block  sizes in an attempt to find the appropriate block
64              size.  This search can be fooled in  some  cases.   This  option
65              forces  e2fsck to only try locating the superblock at a particu‐
66              lar blocksize.  If the superblock is not found, e2fsck will ter‐
67              minate with a fatal error.
68
69       -c     This  option  causes  e2fsck to use badblocks(8) program to do a
70              read-only scan of the device in order to find  any  bad  blocks.
71              If  any  bad  blocks  are found, they are added to the bad block
72              inode to prevent them from being allocated to a file  or  direc‐
73              tory.   If  this  option  is specified twice, then the bad block
74              scan will be done using a non-destructive read-write test.
75
76       -C fd  This option causes e2fsck to write completion information to the
77              specified file descriptor so that the progress of the filesystem
78              check can be monitored.  This option is typically used  by  pro‐
79              grams  which  are running e2fsck.  If the file descriptor speci‐
80              fied is 0, e2fsck will print a completion bar as it  goes  about
81              its  business.   This requires that e2fsck is running on a video
82              console or terminal.
83
84       -d     Print  debugging  output  (useless  unless  you  are   debugging
85              e2fsck).
86
87       -D     Optimize  directories  in filesystem.  This option causes e2fsck
88              to try to optimize all directories, either by reindexing them if
89              the  filesystem  supports directory indexing,  or by sorting and
90              compressing directories for smaller directories, or for filesys‐
91              tems using traditional linear directories.
92
93       -E extended_options
94              Set  e2fsck  extended options.  Extended options are comma sepa‐
95              rated, and may take an argument using  the  equals  ('=')  sign.
96              The following options are supported:
97
98                   ea_ver=extended_attribute_version
99                          Assume  the  format of the extended attribute blocks
100                          in the filesystem is the specified  version  number.
101                          The  version  number  may  be  1  or 2.  The default
102                          extended attribute version format is 2.
103
104       -f     Force checking even if the file system seems clean.
105
106       -F     Flush the filesystem device's buffer  caches  before  beginning.
107              Only really useful for doing e2fsck time trials.
108
109       -j external-journal
110              Set  the pathname where the external-journal for this filesystem
111              can be found.
112
113       -k     When combined with the -c option, any existing bad blocks in the
114              bad  blocks  list are preserved, and any new bad blocks found by
115              running badblocks(8) will be added to the  existing  bad  blocks
116              list.
117
118       -l filename
119              Add  the  block numbers listed in the file specified by filename
120              to the list of bad blocks.  The format of this file is the  same
121              as the one generated by the badblocks(8) program.  Note that the
122              block numbers are based on  the  blocksize  of  the  filesystem.
123              Hence,  badblocks(8) must be given the blocksize of the filesys‐
124              tem in order to obtain correct results.  As a result, it is much
125              simpler  and safer to use the -c option to e2fsck, since it will
126              assure that the correct parameters are passed to  the  badblocks
127              program.
128
129       -L filename
130              Set  the  bad  blocks list to be the list of blocks specified by
131              filename.  (This option is the same as the -l option, except the
132              bad  blocks list is cleared before the blocks listed in the file
133              are added to the bad blocks list.)
134
135       -n     Open the filesystem read-only, and assume an answer of  `no'  to
136              all  questions.   Allows  e2fsck  to  be used non-interactively.
137              (Note: if the -c, -l, or -L options are specified in addition to
138              the -n option, then the filesystem will be opened read-write, to
139              permit the bad-blocks list to be  updated.   However,  no  other
140              changes will be made to the filesystem.)  This option may not be
141              specified at the same time as the -p or -y options.
142
143       -p     Automatically repair ("preen") the  file  system.   This  option
144              will  case  e2fsck  to automatically fix any filesystem problems
145              that can be safely fixed without human intervention.  If  e2fsck
146              discovers  a  problem which may require the system administrator
147              to take  additional  corrective  action,  e2fsck  will  print  a
148              description  of the problem and then exit with the value 4 logi‐
149              cally or'ed into the exit code.  (See the  EXIT  CODE  section.)
150              This  option  is normally used by the system's boot scripts.  It
151              may not be specified at the same time as the -n or -y options.
152
153       -r     This option does nothing at all; it is provided only  for  back‐
154              wards compatibility.
155
156       -s     This  option  will  byte-swap the filesystem so that it is using
157              the normalized, standard byte-order (which  is  i386  or  little
158              endian).   If  the  filesystem  is already in the standard byte-
159              order, e2fsck will take no action.
160
161       -S     This option will byte-swap the  filesystem,  regardless  of  its
162              current byte-order.
163
164       -t     Print  timing  statistics  for  e2fsck.   If this option is used
165              twice, additional timing statistics are printed  on  a  pass  by
166              pass basis.
167
168       -v     Verbose mode.
169
170       -V     Print version information and exit.
171
172       -y     Assume  an answer of `yes' to all questions; allows e2fsck to be
173              used non-interactively.  This option may not be specified at the
174              same time as the -n or -p options.
175

EXIT CODE

177       The  exit  code  returned  by e2fsck is the sum of the following condi‐
178       tions:
179            0    - No errors
180            1    - File system errors corrected
181            2    - File system errors corrected, system should
182                   be rebooted
183            4    - File system errors left uncorrected
184            8    - Operational error
185            16   - Usage or syntax error
186            32   - E2fsck canceled by user request
187            128  - Shared library error
188

SIGNALS

190       The following signals have the following effect when sent to e2fsck.
191
192       SIGUSR1
193              This signal causes e2fsck to start displaying a completion  bar.
194              (See discussion of the -C option.)
195
196       SIGUSR2
197              This signal causes e2fsck to stop displaying a completion bar.
198

REPORTING BUGS

200       Almost  any  piece of software will have bugs.  If you manage to find a
201       filesystem which causes e2fsck to crash, or which e2fsck is  unable  to
202       repair, please report it to the author.
203
204       Please  include  as  much  information  as possible in your bug report.
205       Ideally, include a complete transcript of the e2fsck run, so I can  see
206       exactly  what  error  messages  are displayed.  (Make sure the messages
207       printed by e2fsck are in English; if your system has been configured so
208       that  e2fsck's  messages  have  been  translated into another language,
209       please set the the LC_ALL environment variable to C so that  the  tran‐
210       script  of  e2fsck's  output  will  be  useful  to  me.)  If you have a
211       writable filesystem where the transcript can be stored,  the  script(1)
212       program is a handy way to save the output of e2fsck to a file.
213
214       It  is  also  useful  to send the output of dumpe2fs(8).  If a specific
215       inode or inodes seems to be giving  e2fsck  trouble,  try  running  the
216       debugfs(8)  command  and send the output of the stat(1u) command run on
217       the relevant inode(s).  If the inode is a directory, the  debugfs  dump
218       command  will allow you to extract the contents of the directory inode,
219       which can sent to me after being first run  through  uuencode(1).   The
220       most useful data you can send to help reproduce the bug is a compressed
221       raw image dump of the filesystem, generated using e2image(8).  See  the
222       e2image(8) man page for more details.
223
224       Always include the full version string which e2fsck displays when it is
225       run, so I know which version you are running.
226

AUTHOR

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

SEE ALSO

231       badblocks(8),   dumpe2fs(8),   debugfs(8),    e2image(8),    mke2fs(8),
232       tune2fs(8)
233
234
235
236E2fsprogs version 1.40.2           July 2007                         E2FSCK(8)
Impressum