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

NAME

6       fsck - check and repair a Linux file system
7

SYNOPSIS

9       fsck [ -sAVRTNP ] [ -C [ fd ] ] [ -t fstype ] [filesys ... ] [--] [ fs-
10       specific-options ]
11

DESCRIPTION

13       fsck is used to check and optionally repair one or more Linux file sys‐
14       tems.   filesys  can  be  a device name (e.g.  /dev/hdc1, /dev/sdb2), a
15       mount point (e.g.  /, /usr, /home), or an ext2 label or UUID  specifier
16       (e.g.   UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root).  Nor‐
17       mally, the fsck program will try to  handle  filesystems  on  different
18       physical  disk  drives  in  parallel to reduce the total amount of time
19       needed to check all of the filesystems.
20
21       If no filesystems are specified on the command line, and the -A  option
22       is  not  specified,  fsck  will  default  to  checking  filesystems  in
23       /etc/fstab serially.  This is equivalent to the -As options.
24
25       The exit code returned by fsck is the sum of the following conditions:
26            0    - No errors
27            1    - File system errors corrected
28            2    - System should be rebooted
29            4    - File system errors left uncorrected
30            8    - Operational error
31            16   - Usage or syntax error
32            32   - Fsck canceled by user request
33            128  - Shared library error
34       The exit code returned when multiple file systems are  checked  is  the
35       bit-wise OR of the exit codes for each file system that is checked.
36
37       In  actuality,  fsck  is simply a front-end for the various file system
38       checkers (fsck.fstype) available under Linux.  The file system-specific
39       checker  is  searched for in /sbin first, then in /etc/fs and /etc, and
40       finally in the directories listed in  the  PATH  environment  variable.
41       Please  see  the  file system-specific checker manual pages for further
42       details.
43

OPTIONS

45       -s     Serialize fsck operations.  This is  a  good  idea  if  you  are
46              checking  multiple filesystems and the checkers are in an inter‐
47              active mode.  (Note: e2fsck(8) runs in an  interactive  mode  by
48              default.   To  make e2fsck(8) run in a non-interactive mode, you
49              must either specify the -p or -a option, if you wish for  errors
50              to be corrected automatically, or the -n option if you do not.)
51
52       -t fslist
53              Specifies the type(s) of file system to be checked.  When the -A
54              flag is  specified,  only  filesystems  that  match  fslist  are
55              checked.   The  fslist  parameter  is  a comma-separated list of
56              filesystems and options specifiers.  All of the  filesystems  in
57              this comma-separated list may be prefixed by a negation operator
58              'no' or '!', which requests  that  only  those  filesystems  not
59              listed  in fslist will be checked.  If all of the filesystems in
60              fslist are not prefixed by a negation operator, then only  those
61              filesystems listed in fslist will be checked.
62
63              Options  specifiers  may  be  included  in  the  comma-separated
64              fslist.  They  must  have  the  format  opts=fs-option.   If  an
65              options  specifier  is present, then only filesystems which con‐
66              tain fs-option in their mount options field of  /etc/fstab  will
67              be  checked.  If the options specifier is prefixed by a negation
68              operator, then only those filesystems that do not have fs-option
69              in their mount options field of /etc/fstab will be checked.
70
71              For example, if opts=ro appears in fslist, then only filesystems
72              listed in /etc/fstab with the ro option will be checked.
73
74              For compatibility with Mandrake distributions whose boot scripts
75              depend  upon an unauthorized UI change to the fsck program, if a
76              filesystem type of loop is found in fslist, it is treated as  if
77              opts=loop were specified as an argument to the -t option.
78
79              Normally,  the  filesystem  type  is  deduced  by  searching for
80              filesys in the  /etc/fstab  file  and  using  the  corresponding
81              entry.  If the type can not be deduced, and there is only a sin‐
82              gle filesystem given as an argument to the -t option, fsck  will
83              use  the  specified filesystem type.  If this type is not avail‐
84              able, then the default file  system  type  (currently  ext2)  is
85              used.
86
87       -A     Walk  through the /etc/fstab file and try to check all file sys‐
88              tems in one run.  This option is typically used from the /etc/rc
89              system  initialization  file,  instead  of multiple commands for
90              checking a single file system.
91
92              The root filesystem will be checked first unless the  -P  option
93              is  specified  (see  below).   After  that,  filesystems will be
94              checked in the order specified  by  the  fs_passno  (the  sixth)
95              field  in  the  /etc/fstab  file.   Filesystems with a fs_passno
96              value of 0 are skipped and are not checked at all.   Filesystems
97              with  a  fs_passno value of greater than zero will be checked in
98              order, with filesystems with the lowest fs_passno  number  being
99              checked  first.  If there are multiple filesystems with the same
100              pass number, fsck  will  attempt  to  check  them  in  parallel,
101              although it will avoid running multiple filesystem checks on the
102              same physical disk.
103
104              Hence, a very common configuration in /etc/fstab files is to set
105              the  root  filesystem  to have a fs_passno value of 1 and to set
106              all other filesystems to have a fs_passno value of 2.  This will
107              allow  fsck to automatically run filesystem checkers in parallel
108              if it is advantageous to do  so.   System  administrators  might
109              choose  not to use this configuration if they need to avoid mul‐
110              tiple filesystem checks running in parallel for some reason  ---
111              for  example,  if  the machine in question is short on memory so
112              that excessive paging is a concern.
113
114       -C [  fd  ]
115              Display completion/progress bars for those  filesystem  checkers
116              (currently  only  for  ext2 and ext3) which support them.   Fsck
117              will manage the filesystem checkers so that  only  one  of  them
118              will display a progress bar at a time.  GUI front-ends may spec‐
119              ify a file descriptor fd, in which case the progress bar  infor‐
120              mation will be sent to that file descriptor.
121
122       -N     Don't execute, just show what would be done.
123
124       -P     When  the  -A flag is set, check the root filesystem in parallel
125              with the other filesystems.  This is not the safest thing in the
126              world  to  do,  since  if the root filesystem is in doubt things
127              like the e2fsck(8) executable might be corrupted!   This  option
128              is  mainly provided for those sysadmins who don't want to repar‐
129              tition the root filesystem to be small  and  compact  (which  is
130              really the right solution).
131
132       -R     When  checking  all file systems with the -A flag, skip the root
133              file system (in case it's already mounted read-write).
134
135       -T     Don't show the title on startup.
136
137       -V     Produce verbose output, including all file system-specific  com‐
138              mands that are executed.
139
140       fs-specific-options
141              Options  which  are  not  understood  by  fsck are passed to the
142              filesystem-specific checker.   These  arguments  must  not  take
143              arguments,  as  there  is no way for fsck to be able to properly
144              guess which arguments take options and which don't.
145
146              Options and arguments which follow the -- are  treated  as  file
147              system-specific options to be passed to the file system-specific
148              checker.
149
150              Please note that fsck is not designed to pass  arbitrarily  com‐
151              plicated  options  to  filesystem-specific  checkers.  If you're
152              doing something complicated, please just execute the filesystem-
153              specific  checker directly.  If you pass fsck some horribly com‐
154              plicated option and  arguments,  and  it  doesn't  do  what  you
155              expect,  don't bother reporting it as a bug.  You're almost cer‐
156              tainly doing something that you shouldn't be doing with fsck.
157
158       Options to different filesystem-specific fsck's are  not  standardized.
159       If  in  doubt,  please consult the man pages of the filesystem-specific
160       checker.  Although not guaranteed, the following options are  supported
161       by most file system checkers:
162
163       -a     Automatically  repair the file system without any questions (use
164              this option with caution).  Note that e2fsck(8) supports -a  for
165              backwards compatibility only.  This option is mapped to e2fsck's
166              -p option which is safe to use, unlike the -a option  that  some
167              file system checkers support.
168
169       -n     For  some filesystem-specific checkers, the -n option will cause
170              the fs-specific fsck to avoid attempting to repair any problems,
171              but  simply report such problems to stdout.  This is however not
172              true  for  all  filesystem-specific  checkers.   In  particular,
173              fsck.reiserfs(8)  will  not  report any corruption if given this
174              option.  fsck.minix(8) does not support the -n option at all.
175
176       -r     Interactively repair the  filesystem  (ask  for  confirmations).
177              Note:  It is generally a bad idea to use this option if multiple
178              fsck's are being run  in  parallel.   Also  note  that  this  is
179              e2fsck's default behavior; it supports this option for backwards
180              compatibility reasons only.
181
182       -y     For some filesystem-specific checkers, the -y option will  cause
183              the  fs-specific  fsck  to  always  attempt  to fix any detected
184              filesystem corruption automatically.  Sometimes an expert may be
185              able  to do better driving the fsck manually.  Note that not all
186              filesystem-specific checkers implement this option.  In particu‐
187              lar  fsck.minix(8)  and  fsck.cramfs(8)  does not support the -y
188              option as of this writing.
189

AUTHOR

191       Theodore Ts'o (tytso@mit.edu)
192

FILES

194       /etc/fstab.
195

ENVIRONMENT VARIABLES

197       The fsck program's behavior is affected by  the  following  environment
198       variables:
199
200       FSCK_FORCE_ALL_PARALLEL
201              If  this  environment  variable is set, fsck will attempt to run
202              all of the specified  filesystems  in  parallel,  regardless  of
203              whether  the filesystems appear to be on the same device.  (This
204              is useful for RAID systems or high-end storage systems  such  as
205              those sold by companies such as IBM or EMC.)
206
207       FSCK_MAX_INST
208              This  environment variable will limit the maximum number of file
209              system checkers that can be running at one  time.   This  allows
210              configurations  which have a large number of disks to avoid fsck
211              starting too many file system  checkers  at  once,  which  might
212              overload  CPU  and memory resources available on the system.  If
213              this value is zero, then an unlimited number of processes can be
214              spawned.   This is currently the default, but future versions of
215              fsck may attempt to automatically determine how many file system
216              checks  can  be  run based on gathering accounting data from the
217              operating system.
218
219       PATH   The PATH environment variable is used to find file system check‐
220              ers.   A  set  of  system directories are searched first: /sbin,
221              /sbin/fs.d, /sbin/fs, /etc/fs, and /etc.  Then the set of direc‐
222              tories found in the PATH environment are searched.
223
224       FSTAB_FILE
225              This  environment  variable  allows  the system administrator to
226              override the standard location of the /etc/fstab  file.   It  is
227              also useful for developers who are testing fsck.
228

SEE ALSO

230       fstab(5),  mkfs(8),  fsck.ext2(8)  or fsck.ext3(8) or e2fsck(8), cramf‐
231       sck(8),   fsck.minix(8),   fsck.msdos(8),   fsck.jfs(8),   fsck.nfs(8),
232       fsck.vfat(8), fsck.xfs(8), fsck.xiafs(8), reiserfsck(8).
233
234
235
236E2fsprogs version 1.40.2           July 2007                           FSCK(8)
Impressum