]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - misc/fsck.8.in
ext2fs: nls: support UTF-8 11.0 with NFKD normalization
[thirdparty/e2fsprogs.git] / misc / fsck.8.in
CommitLineData
3839e657 1.\" -*- nroff -*-
a418d3ad
TT
2.\" Copyright 1993, 1994, 1995 by Theodore Ts'o. All Rights Reserved.
3.\" This file may be copied under the terms of the GNU Public License.
d04ad325 4.\"
74becf3c 5.TH FSCK 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
3839e657
TT
6.SH NAME
7fsck \- check and repair a Linux file system
8.SH SYNOPSIS
9.B fsck
10[
fe263da9 11.B \-sAVRTMNP
22dcccdd
TT
12]
13[
14.B \-C
15[
16.I fd
17]
3839e657
TT
18]
19[
20.B \-t
21.I fstype
d04ad325 22]
a1411354 23.I [filesys ... ]
1d349cce 24[\-\-] [
f044b4d8 25.B fs-specific-options
3839e657 26]
3839e657
TT
27.SH DESCRIPTION
28.B fsck
d04ad325 29is used to check and optionally repair one or more Linux file systems.
3839e657 30.I filesys
caf8ce4c
TT
31can be a device name (e.g.
32.IR /dev/hdc1 ", " /dev/sdb2 ),
33a mount point (e.g.
34.IR / ", " /usr ", " /home ),
35or an ext2 label or UUID specifier (e.g.
d04ad325
TT
36UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root).
37Normally, the
38.B fsck
39program will try to handle filesystems on different physical disk drives
f37ab68a
TT
40in parallel to reduce the total amount of time needed to check all of the
41filesystems.
3839e657 42.PP
d04ad325
TT
43If no filesystems are specified on the command line, and the
44.B \-A
45option is not specified,
a1411354
TT
46.B fsck
47will default to checking filesystems in
48.B /etc/fstab
d04ad325 49serially. This is equivalent to the
a1411354
TT
50.B \-As
51options.
52.PP
3839e657
TT
53The exit code returned by
54.B fsck
55is the sum of the following conditions:
56.br
57\ 0\ \-\ No errors
58.br
59\ 1\ \-\ File system errors corrected
60.br
61\ 2\ \-\ System should be rebooted
62.br
63\ 4\ \-\ File system errors left uncorrected
64.br
65\ 8\ \-\ Operational error
66.br
67\ 16\ \-\ Usage or syntax error
68.br
4cae0452
TT
69\ 32\ \-\ Fsck canceled by user request
70.br
3839e657
TT
71\ 128\ \-\ Shared library error
72.br
d04ad325 73The exit code returned when multiple file systems are checked
a1411354 74is the bit-wise OR of the exit codes for each
3839e657
TT
75file system that is checked.
76.PP
77In actuality,
78.B fsck
79is simply a front-end for the various file system checkers
80(\fBfsck\fR.\fIfstype\fR) available under Linux. The file
caf8ce4c
TT
81system-specific checker is searched for in
82.I /sbin
83first, then in
84.I /etc/fs
85and
86.IR /etc ,
87and finally in the directories listed in the PATH environment
3839e657
TT
88variable. Please see the file system-specific checker manual pages for
89further details.
90.SH OPTIONS
91.TP
caf8ce4c 92.B \-s
d04ad325
TT
93Serialize
94.B fsck
f044b4d8 95operations. This is a good idea if you are checking multiple
50787ea2
TT
96filesystems and the checkers are in an interactive mode. (Note:
97.BR e2fsck (8)
d04ad325 98runs in an interactive mode by default. To make
50787ea2
TT
99.BR e2fsck (8)
100run in a non-interactive mode, you must either specify the
caf8ce4c 101.B \-p
50787ea2 102or
caf8ce4c 103.B \-a
d04ad325 104option, if you wish for errors to be corrected automatically, or the
caf8ce4c 105.B \-n
50787ea2
TT
106option if you do not.)
107.TP
10a32f1e
TT
108.BI \-t " fslist"
109Specifies the type(s) of file system to be checked. When the
d04ad325
TT
110.B \-A
111flag is specified, only filesystems that match
10a32f1e
TT
112.I fslist
113are checked. The
114.I fslist
115parameter is a comma-separated list of filesystems and options
116specifiers. All of the filesystems in this comma-separated list may be
d04ad325 117prefixed by a negation operator
10a32f1e 118.RB ' no '
d04ad325 119or
10a32f1e
TT
120.RB ' ! ',
121which requests that only those filesystems not listed in
122.I fslist
d04ad325 123will be checked. If all of the filesystems in
10a32f1e
TT
124.I fslist
125are not prefixed by a negation operator, then only those filesystems
126listed
127in
128.I fslist
129will be checked.
130.sp
f37ab68a 131Options specifiers may be included in the comma-separated
10a32f1e 132.IR fslist .
d04ad325 133They must have the format
f044b4d8
TT
134.BI opts= fs-option\fR.
135If an options specifier is present, then only filesystems which contain
136.I fs-option
d04ad325 137in their mount options field of
10a32f1e 138.B /etc/fstab
f044b4d8 139will be checked. If the options specifier is prefixed by a negation
d04ad325 140operator, then only
f044b4d8 141those filesystems that do not have
10a32f1e 142.I fs-option
f044b4d8 143in their mount options field of
d04ad325 144.B /etc/fstab
f044b4d8
TT
145will be checked.
146.sp
147For example, if
148.B opts=ro
149appears in
150.IR fslist ,
151then only filesystems listed in
d04ad325 152.B /etc/fstab
f044b4d8
TT
153with the
154.B ro
155option will be checked.
10a32f1e
TT
156.sp
157For compatibility with Mandrake distributions whose boot scripts
158depend upon an unauthorized UI change to the
159.B fsck
160program, if a filesystem type of
161.B loop
162is found in
163.IR fslist ,
164it is treated as if
165.B opts=loop
166were specified as an argument to the
167.B \-t
168option.
50787ea2
TT
169.sp
170Normally, the filesystem type is deduced by searching for
171.I filesys
d04ad325
TT
172in the
173.I /etc/fstab
50787ea2 174file and using the corresponding entry.
d04ad325
TT
175If the type can not be deduced, and there is only a single filesystem
176given as an argument to the
177.B \-t
178option,
50787ea2 179.B fsck
10a32f1e 180will use the specified filesystem type. If this type is not
d04ad325 181available, then the default file system type (currently ext2) is used.
50787ea2 182.TP
caf8ce4c 183.B \-A
3839e657
TT
184Walk through the
185.I /etc/fstab
186file and try to check all file systems in one run. This option is
187typically used from the
188.I /etc/rc
8139367b 189system initialization file, instead of multiple commands for checking
f3db3566 190a single file system.
7953f610
TT
191.sp
192The root filesystem will be checked first unless the
caf8ce4c 193.B \-P
d04ad325
TT
194option is specified (see below). After that,
195filesystems will be checked in the order specified by the
196.I fs_passno
197(the sixth) field in the
7953f610 198.I /etc/fstab
d04ad325
TT
199file.
200Filesystems with a
2d09179a 201.I fs_passno
9b61b8c4
TT
202value of 0 are skipped and are not checked at all. Filesystems with a
203.I fs_passno
d04ad325 204value of greater than zero will be checked in order,
9b61b8c4 205with filesystems with the lowest
d04ad325 206.I fs_passno
9b61b8c4 207number being checked first.
d04ad325
TT
208If there are multiple filesystems with the same pass number,
209fsck will attempt to check them in parallel, although it will avoid running
210multiple filesystem checks on the same physical disk.
9b61b8c4 211.sp
d04ad325 212Hence, a very common configuration in
7953f610 213.I /etc/fstab
d04ad325 214files is to set the root filesystem to have a
7953f610
TT
215.I fs_passno
216value of 1
f37ab68a 217and to set all other filesystems to have a
7953f610
TT
218.I fs_passno
219value of 2. This will allow
220.B fsck
221to automatically run filesystem checkers in parallel if it is advantageous
222to do so. System administrators might choose
8d641749 223not to use this configuration if they need to avoid multiple filesystem
7953f610
TT
224checks running in parallel for some reason --- for example, if the
225machine in question is short on memory so that
226excessive paging is a concern.
f3db3566 227.TP
22dcccdd 228.B \-C\fR [ \fI "fd" \fR ]
d04ad325 229Display completion/progress bars for those filesystem checkers (currently
22dcccdd 230only for ext2 and ext3) which support them. Fsck will manage the
d04ad325 231filesystem checkers so that only one of them will display
22dcccdd
TT
232a progress bar at a time. GUI front-ends may specify a file descriptor
233.IR fd ,
f37ab68a 234in which case the progress bar information will be sent to that file descriptor.
f3db3566 235.TP
fe263da9
TT
236.B \-M
237Do not check mounted filesystems and return an exit code of 0
238for mounted filesystems.
239.TP
caf8ce4c 240.B \-N
f3db3566 241Don't execute, just show what would be done.
3839e657 242.TP
caf8ce4c 243.B \-P
d04ad325 244When the
caf8ce4c 245.B \-A
7f88b043
TT
246flag is set, check the root filesystem in parallel with the other filesystems.
247This is not the safest thing in the world to do,
d04ad325
TT
248since if the root filesystem is in doubt things like the
249.BR e2fsck (8)
583ccdc3 250executable might be corrupted! This option is mainly provided
7f88b043
TT
251for those sysadmins who don't want to repartition the root
252filesystem to be small and compact (which is really the right solution).
253.TP
caf8ce4c 254.B \-R
50787ea2
TT
255When checking all file systems with the
256.B \-A
257flag, skip the root file system (in case it's already mounted read-write).
258.TP
caf8ce4c 259.B \-T
50787ea2 260Don't show the title on startup.
3839e657 261.TP
caf8ce4c 262.B \-V
3839e657
TT
263Produce verbose output, including all file system-specific commands
264that are executed.
3839e657 265.TP
f044b4d8 266.B fs-specific-options
d04ad325
TT
267Options which are not understood by
268.B fsck
609c9d0f
TT
269are passed to the filesystem-specific checker. These arguments
270.B must
271not take arguments, as there is no
d04ad325 272way for
609c9d0f
TT
273.B fsck
274to be able to properly guess which arguments take options and which
275don't.
276.IP
277Options and arguments which follow the
caf8ce4c 278.B \-\-
609c9d0f 279are treated as file system-specific options to be passed to the
f3db3566 280file system-specific checker.
609c9d0f
TT
281.IP
282Please note that fsck is not
283designed to pass arbitrarily complicated options to filesystem-specific
284checkers. If you're doing something complicated, please just
d04ad325 285execute the filesystem-specific checker directly. If you pass
609c9d0f
TT
286.B fsck
287some horribly complicated option and arguments, and it doesn't do
d04ad325 288what you expect,
609c9d0f
TT
289.B don't bother reporting it as a bug.
290You're almost certainly doing something that you shouldn't be doing
d04ad325 291with
609c9d0f 292.BR fsck.
3839e657 293.PP
64c90eec
TT
294Options to different filesystem-specific fsck's are not standardized.
295If in doubt, please consult the man pages of the filesystem-specific
296checker. Although not guaranteed, the following options are supported
583ccdc3 297by most file system checkers:
3839e657 298.TP
caf8ce4c 299.B \-a
3839e657 300Automatically repair the file system without any questions (use
d04ad325 301this option with caution). Note that
583ccdc3 302.BR e2fsck (8)
d04ad325 303supports
caf8ce4c 304.B \-a
d04ad325 305for backwards compatibility only. This option is mapped to
583ccdc3 306.BR e2fsck 's
caf8ce4c 307.B \-p
d04ad325
TT
308option which is safe to use, unlike the
309.B \-a
64c90eec
TT
310option that some file system checkers support.
311.TP
312.B \-n
d04ad325 313For some filesystem-specific checkers, the
64c90eec 314.B \-n
d04ad325 315option will cause the fs-specific fsck to avoid attempting to repair any
64c90eec 316problems, but simply report such problems to stdout. This is however
d04ad325 317not true for all filesystem-specific checkers. In particular,
64c90eec
TT
318.BR fsck.reiserfs (8)
319will not report any corruption if given this option.
320.BR fsck.minix (8)
d04ad325
TT
321does not support the
322.B \-n
64c90eec 323option at all.
3839e657 324.TP
caf8ce4c 325.B \-r
3839e657
TT
326Interactively repair the filesystem (ask for confirmations). Note: It
327is generally a bad idea to use this option if multiple fsck's are being
d04ad325 328run in parallel. Also note that this is
583ccdc3 329.BR e2fsck 's
3839e657
TT
330default behavior; it supports this option for backwards compatibility
331reasons only.
64c90eec
TT
332.TP
333.B \-y
d04ad325
TT
334For some filesystem-specific checkers, the
335.B \-y
64c90eec
TT
336option will cause the fs-specific fsck to always attempt to fix any
337detected filesystem corruption automatically. Sometimes an expert may
d04ad325 338be able to do better driving the fsck manually. Note that
64c90eec 339.B not
d04ad325 340all filesystem-specific checkers implement this option. In particular
64c90eec
TT
341.BR fsck.minix (8)
342and
343.BR fsck.cramfs (8)
344does not support the
345.B -y
346option as of this writing.
3839e657
TT
347.SH AUTHOR
348Theodore Ts'o (tytso@mit.edu)
f3db3566
TT
349.SH FILES
350.IR /etc/fstab .
a1069118
TT
351.SH ENVIRONMENT VARIABLES
352The
353.B fsck
354program's behavior is affected by the following environment variables:
355.TP
356.B FSCK_FORCE_ALL_PARALLEL
d04ad325 357If this environment variable is set,
a1069118
TT
358.B fsck
359will attempt to run all of the specified filesystems in parallel,
360regardless of whether the filesystems appear to be on the same
361device. (This is useful for RAID systems or high-end storage systems
362such as those sold by companies such as IBM or EMC.)
363.TP
364.B FSCK_MAX_INST
365This environment variable will limit the maximum number of file system
366checkers that can be running at one time. This allows configurations
d04ad325 367which have a large number of disks to avoid
a1069118
TT
368.B fsck
369starting too many file system checkers at once, which might overload
370CPU and memory resources available on the system. If this value is
371zero, then an unlimited number of processes can be spawned. This is
372currently the default, but future versions of
373.B fsck
374may attempt to automatically determine how many file system checks can
375be run based on gathering accounting data from the operating system.
376.TP
377.B PATH
d04ad325 378The
a1069118
TT
379.B PATH
380environment variable is used to find file system checkers. A set of
d04ad325 381system directories are searched first:
a1069118
TT
382.BR /sbin ,
383.BR /sbin/fs.d ,
384.BR /sbin/fs ,
385.BR /etc/fs ,
d04ad325 386and
a1069118
TT
387.BR /etc .
388Then the set of directories found in the
389.B PATH
390environment are searched.
391.TP
392.B FSTAB_FILE
d04ad325
TT
393This environment variable allows the system administrator
394to override the standard location of the
a1069118 395.B /etc/fstab
f37ab68a 396file. It is also useful for developers who are testing
a1069118 397.BR fsck .
3839e657 398.SH SEE ALSO
f3db3566 399.BR fstab (5),
3839e657 400.BR mkfs (8),
3839e657
TT
401.BR fsck.ext2 (8)
402or
a519836a
TT
403.BR fsck.ext3 (8)
404or
3839e657 405.BR e2fsck (8),
a519836a 406.BR cramfsck (8),
64c90eec 407.BR fsck.minix (8),
a519836a
TT
408.BR fsck.msdos (8),
409.BR fsck.jfs (8),
410.BR fsck.nfs (8),
411.BR fsck.vfat (8),
64c90eec 412.BR fsck.xfs (8),
a519836a 413.BR fsck.xiafs (8),
64c90eec 414.BR reiserfsck (8).