1FSCK(8)                      System Administration                     FSCK(8)
2
3
4

NAME

6       fsck - check and repair a Linux filesystem
7

SYNOPSIS

9       fsck  [-lsAVRTMNP] [-r [fd]] [-C [fd]] [-t fstype] [filesystem...] [--]
10       [fs-specific-options]
11

DESCRIPTION

13       fsck is used to check and optionally repair one or more Linux  filesys‐
14       tems.   filesys  can  be  a device name (e.g.  /dev/hdc1, /dev/sdb2), a
15       mount point (e.g.  /, /usr, /home), or  an  filesystem  label  or  UUID
16       specifier     (e.g.     UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd    or
17       LABEL=root).  Normally, the fsck program will try to handle filesystems
18       on  different  physical  disk  drives  in  parallel to reduce the total
19       amount of time needed to check all of them.
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
27              0      No errors
28              1      Filesystem errors corrected
29              2      System should be rebooted
30              4      Filesystem errors left uncorrected
31              8      Operational error
32              16     Usage or syntax error
33              32     Checking canceled by user request
34              128    Shared-library error
35
36       The exit code returned when multiple filesystems  are  checked  is  the
37       bit-wise OR of the exit codes for each filesystem that is checked.
38
39       In  actuality,  fsck  is  simply a front-end for the various filesystem
40       checkers (fsck.fstype) available under Linux.  The  filesystem-specific
41       checker  is  searched for in the PATH environment variable. If the PATH
42       is undefined then fallback to "/sbin".
43
44       Please see the filesystem-specific checker  manual  pages  for  further
45       details.
46

OPTIONS

48       -l     Create       an      exclusive      flock(2)      lock      file
49              (/run/fsck/<diskname>.lock) for whole-disk device.  This  option
50              can  be used with one device only (this means that -A and -l are
51              mutually exclusive).   This  option  is  recommended  when  more
52              fsck(8)  instances are executed in the same time.  The option is
53              ignored when used  for  multiple  devices  or  for  non-rotating
54              disks.   fsck  does not lock underlying devices when executed to
55              check stacked devices (e.g. MD or DM)  –  this  feature  is  not
56              implemented yet.
57
58       -r [fd]
59              Report  certain  statistics  for  each  fsck  when it completes.
60              These statistics include the exit status, the  maximum  run  set
61              size (in kilobytes), the elapsed all-clock time and the user and
62              system CPU time used by the fsck run.  For example:
63
64              /dev/sda1: status 0, rss 92828, real  4.002804,  user  2.677592,
65              sys 0.86186
66
67              GUI  front-ends  may specify a file descriptor fd, in which case
68              the progress bar information will be sent to that file  descrip‐
69              tor in a machine parsable format.  For example:
70
71              /dev/sda1 0 92828 4.002804 2.677592 0.86186
72
73       -s     Serialize  fsck  operations.   This  is  a  good idea if you are
74              checking multiple filesystems and the checkers are in an  inter‐
75              active  mode.   (Note:  e2fsck(8) runs in an interactive mode by
76              default.  To make e2fsck(8) run in a non-interactive  mode,  you
77              must  either specify the -p or -a option, if you wish for errors
78              to be corrected automatically, or the -n option if you do not.)
79
80       -t fslist
81              Specifies the type(s) of filesystem to be checked.  When the  -A
82              flag  is  specified,  only  filesystems  that  match  fslist are
83              checked.  The fslist parameter  is  a  comma-separated  list  of
84              filesystems  and  options specifiers.  All of the filesystems in
85              this comma-separated list may be prefixed by a negation operator
86              'no'  or  '!',  which  requests  that only those filesystems not
87              listed in fslist will be checked.  If none of the filesystems in
88              fslist  is  prefixed  by  a  negation  operator, then only those
89              listed filesystems will be checked.
90
91              Options  specifiers  may  be  included  in  the  comma-separated
92              fslist.   They  must  have  the  format  opts=fs-option.   If an
93              options specifier is present, then only filesystems  which  con‐
94              tain  fs-option  in their mount options field of /etc/fstab will
95              be checked.  If the options specifier is prefixed by a  negation
96              operator, then only those filesystems that do not have fs-option
97              in their mount options field of /etc/fstab will be checked.
98
99              For example, if opts=ro appears in fslist, then only filesystems
100              listed in /etc/fstab with the ro option will be checked.
101
102              For compatibility with Mandrake distributions whose boot scripts
103              depend upon an unauthorized UI change to the fsck program, if  a
104              filesystem  type of loop is found in fslist, it is treated as if
105              opts=loop were specified as an argument to the -t option.
106
107              Normally, the  filesystem  type  is  deduced  by  searching  for
108              filesys  in  the  /etc/fstab  file  and  using the corresponding
109              entry.  If the type cannot be deduced, and there is only a  sin‐
110              gle  filesystem given as an argument to the -t option, fsck will
111              use the specified filesystem type.  If this type is  not  avail‐
112              able, then the default filesystem type (currently ext2) is used.
113
114       -A     Walk  through  the /etc/fstab file and try to check all filesys‐
115              tems in one run.  This option is typically used from the /etc/rc
116              system  initialization  file,  instead  of multiple commands for
117              checking a single filesystem.
118
119              The root filesystem will be checked first unless the  -P  option
120              is  specified  (see  below).   After  that,  filesystems will be
121              checked in the order specified  by  the  fs_passno  (the  sixth)
122              field  in  the  /etc/fstab  file.   Filesystems with a fs_passno
123              value of 0 are skipped and are not checked at all.   Filesystems
124              with  a  fs_passno value of greater than zero will be checked in
125              order, with filesystems with the lowest fs_passno  number  being
126              checked  first.  If there are multiple filesystems with the same
127              pass number, fsck  will  attempt  to  check  them  in  parallel,
128              although it will avoid running multiple filesystem checks on the
129              same physical disk.
130
131              fsck does not check stacked devices (RAIDs,  dm-crypt,  ...)  in
132              parallel    with    any    other    device.    See   below   for
133              FSCK_FORCE_ALL_PARALLEL setting.  The /sys filesystem is used to
134              determine dependencies between devices.
135
136              Hence, a very common configuration in /etc/fstab files is to set
137              the root filesystem to have a fs_passno value of 1  and  to  set
138              all other filesystems to have a fs_passno value of 2.  This will
139              allow fsck to automatically run filesystem checkers in  parallel
140              if  it  is  advantageous  to do so.  System administrators might
141              choose not to use this configuration if they need to avoid  mul‐
142              tiple  filesystem  checks  running in parallel for some reason –
143              for example, if the machine in question is short  on  memory  so
144              that excessive paging is a concern.
145
146              fsck  normally does not check whether the device actually exists
147              before calling a filesystem specific  checker.   Therefore  non-
148              existing devices may cause the system to enter filesystem repair
149              mode during boot if the filesystem specific  checker  returns  a
150              fatal  error.  The /etc/fstab mount option nofail may be used to
151              have fsck skip non-existing devices.  fsck also skips non-exist‐
152              ing devices that have the special filesystem type auto.
153
154       -C [fd]
155              Display  completion/progress  bars for those filesystem checkers
156              (currently only for ext[234]) which  support  them.   fsck  will
157              manage  the  filesystem  checkers  so that only one of them will
158              display a progress bar at a time.  GUI front-ends may specify  a
159              file  descriptor  fd, in which case the progress bar information
160              will be sent to that file descriptor.
161
162       -M     Do not check mounted filesystems and return an exit  code  of  0
163              for mounted filesystems.
164
165       -N     Don't execute, just show what would be done.
166
167       -P     When  the  -A flag is set, check the root filesystem in parallel
168              with the other filesystems.  This is not the safest thing in the
169              world  to  do,  since  if the root filesystem is in doubt things
170              like the e2fsck(8) executable might be corrupted!   This  option
171              is  mainly provided for those sysadmins who don't want to repar‐
172              tition the root filesystem to be small  and  compact  (which  is
173              really the right solution).
174
175       -R     When  checking  all  filesystems with the -A flag, skip the root
176              filesystem.  (This is useful in case  the  root  filesystem  has
177              already been mounted read-write.)
178
179       -T     Don't show the title on startup.
180
181       -V     Produce  verbose  output, including all filesystem-specific com‐
182              mands that are executed.
183
184       -?, --help
185              Display help text and exit.
186
187       --version
188              Display version information and exit.
189

FILESYSTEM SPECIFIC OPTIONS

191       Options which are not understood by fsck are passed to the  filesystem-
192       specific checker!
193
194       These  options  must not take arguments, as there is no way for fsck to
195       be able to properly guess which options take arguments and which don't.
196
197       Options and arguments which follow the -- are  treated  as  filesystem-
198       specific options to be passed to the filesystem-specific checker.
199
200       Please  note  that fsck is not designed to pass arbitrarily complicated
201       options to filesystem-specific checkers.   If  you're  doing  something
202       complicated,   please  just  execute  the  filesystem-specific  checker
203       directly.  If you pass fsck some horribly complicated options and argu‐
204       ments,  and it doesn't do what you expect, don't bother reporting it as
205       a bug.  You're almost certainly doing something that you  shouldn't  be
206       doing  with  fsck.  Options to different filesystem-specific fsck's are
207       not standardized.
208

FILES

210       /etc/fstab
211

ENVIRONMENT VARIABLES

213       The fsck program's behavior is affected by  the  following  environment
214       variables:
215
216       FSCK_FORCE_ALL_PARALLEL
217              If  this environment variable is set, fsck will attempt to check
218              all of the specified  filesystems  in  parallel,  regardless  of
219              whether  the filesystems appear to be on the same device.  (This
220              is useful for RAID systems or high-end storage systems  such  as
221              those  sold  by  companies  such  as IBM or EMC.)  Note that the
222              fs_passno value is still used.
223
224       FSCK_MAX_INST
225              This environment variable  will  limit  the  maximum  number  of
226              filesystem  checkers  that  can  be  running  at one time.  This
227              allows configurations which have a  large  number  of  disks  to
228              avoid  fsck starting too many filesystem checkers at once, which
229              might overload CPU and memory resources available on the system.
230              If this value is zero, then an unlimited number of processes can
231              be spawned.  This is currently the default, but future  versions
232              of fsck may attempt to automatically determine how many filesys‐
233              tem checks can be run based on gathering  accounting  data  from
234              the operating system.
235
236       PATH   The  PATH environment variable is used to find filesystem check‐
237              ers.
238
239       FSTAB_FILE
240              This environment variable allows  the  system  administrator  to
241              override  the  standard  location of the /etc/fstab file.  It is
242              also useful for developers who are testing fsck.
243
244       LIBBLKID_DEBUG=all
245              enables libblkid debug output.
246
247       LIBMOUNT_DEBUG=all
248              enables libmount debug output.
249

SEE ALSO

251       fstab(5), mkfs(8), fsck.ext2(8) or fsck.ext3(8) or e2fsck(8), cramf‐
252       sck(8), fsck.jfs(8), fsck.nfs(8), fsck.minix(8), fsck.msdos(8),
253       fsck.vfat(8), fsck.xfs(8), reiserfsck(8)
254

AUTHORS

256       Theodore Ts'o <tytso@mit.edu>
257       Karel Zak <kzak@redhat.com>
258

AVAILABILITY

260       The fsck command is part of the util-linux  package  and  is  available
261       from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
262       linux/⟩.
263
264
265
266util-linux                       February 2009                         FSCK(8)
Impressum