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 status returned by fsck is the sum  of  the  following  condi‐
26       tions:
27
28              0      No errors
29              1      Filesystem errors corrected
30              2      System should be rebooted
31              4      Filesystem errors left uncorrected
32              8      Operational error
33              16     Usage or syntax error
34              32     Checking canceled by user request
35              128    Shared-library error
36
37       The  exit  status returned when multiple filesystems are checked is the
38       bit-wise OR of the exit statuses for each filesystem that is checked.
39
40       In actuality, fsck is simply a front-end  for  the  various  filesystem
41       checkers  (fsck.fstype) available under Linux.  The filesystem-specific
42       checker is searched for in the PATH environment variable. If  the  PATH
43       is undefined then fallback to "/sbin".
44
45       Please  see  the  filesystem-specific  checker manual pages for further
46       details.
47

OPTIONS

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

FILESYSTEM SPECIFIC OPTIONS

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

ENVIRONMENT

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

FILES

249       /etc/fstab
250

AUTHORS

252       Theodore Ts'o <tytso@mit.edu>
253       Karel Zak <kzak@redhat.com>
254

SEE ALSO

256       fstab(5), mkfs(8), fsck.ext2(8) or fsck.ext3(8) or e2fsck(8),
257       fsck.cramfs(8), fsck.jfs(8), fsck.nfs(8), fsck.minix(8), fsck.msdos(8),
258       fsck.vfat(8), fsck.xfs(8), reiserfsck(8)
259

AVAILABILITY

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