Whamcloud - gitweb
ChangeLog, fsck.c:
[tools/e2fsprogs.git] / misc / fsck.8.in
1 .\" -*- nroff -*-
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.
4 .\" 
5 .TH FSCK 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
6 .SH NAME
7 fsck \- check and repair a Linux file system
8 .SH SYNOPSIS
9 .B fsck
10 [
11 .B \-AVRTNP
12 ]
13 [
14 .B \-s
15 ]
16 [
17 .B \-t
18 .I fstype
19 ]
20 [
21 .B fs-options
22 ]
23 .I filesys [ ... ]
24 .SH DESCRIPTION
25 .B fsck
26 is used to check and optionally repair a Linux file system.  
27 .I filesys
28 is either the device name (e.g. /dev/hda1, /dev/sdb2) or the mount point
29 (e.g. /, /usr, /home) for the file system.  If this invocation of 
30 .B fsck 
31 has several filesystems on different physical disk drives to check, then
32 .B fsck 
33 will try to run them in parallel.  This reduces the total amount time it
34 takes to check all of the filesystems, since 
35 .B fsck
36 takes advantage of the parallelism of multiple disk spindles.
37 .PP
38 The exit code returned by
39 .B fsck
40 is the sum of the following conditions:
41 .br
42 \       0\      \-\ No errors
43 .br
44 \       1\      \-\ File system errors corrected
45 .br
46 \       2\      \-\ System should be rebooted
47 .br
48 \       4\      \-\ File system errors left uncorrected
49 .br
50 \       8\      \-\ Operational error
51 .br
52 \       16\     \-\ Usage or syntax error
53 .br
54 \       128\    \-\ Shared library error
55 .br
56 The exit code returned when all file systems are checked using the
57 .B -A
58 option is the bit-wise OR of the exit codes for each
59 file system that is checked.
60 .PP
61 In actuality,
62 .B fsck
63 is simply a front-end for the various file system checkers
64 (\fBfsck\fR.\fIfstype\fR) available under Linux.  The file
65 system-specific checker is searched for in /sbin first, then in /etc/fs
66 and /etc, and finally in the directories listed in the PATH environment
67 variable.  Please see the file system-specific checker manual pages for
68 further details.
69 .SH OPTIONS
70 .TP
71 .B -A
72 Walk through the
73 .I /etc/fstab
74 file and try to check all file systems in one run.  This option is
75 typically used from the
76 .I /etc/rc
77 system initalization file, instead of multiple commands for checking
78 a single file system.
79 .sp
80 The root filesystem will be checked first unless the
81 .B -P
82 option is specified (see below).  After that, 
83 filesystems will be checked in the order specified by the 
84 .I fs_passno 
85 (the sixth) field in the 
86 .I /etc/fstab
87 file.  If there are multiple filesystems with the same pass number, 
88 e2fsck will attempt to check them in parallel, although it will avoid running 
89 multiple filesystem checks on the same physical disk.  Hence, 
90 a very common configuration in 
91 .I /etc/fstab
92 files is to set the root filesystem to have a 
93 .I fs_passno
94 value of 1
95 and to set all filesystems to have a
96 .I fs_passno
97 value of 2.  This will allow
98 .B fsck
99 to automatically run filesystem checkers in parallel if it is advantageous
100 to do so.  System administrators might choose
101 not to use this configuration  if they need to avoid multiple filesystem
102 checks running in parallel for some reason --- for example, if the
103 machine in question is short on memory so that
104 excessive paging is a concern.
105 .TP
106 .B -R
107 When checking all file systems with the
108 .B \-A
109 flag, skip the root file system (in case it's already mounted read-write).
110 .TP
111 .B -T
112 Don't show the title on startup.
113 .TP
114 .B -N
115 Don't execute, just show what would be done.
116 .TP
117 .B -P
118 When the 
119 .B -A
120 flag is set, check the root filesystem in parallel with the other filesystems.
121 This is not the safest thing in the world to do,
122 since if the root filesystem is in doubt things like the 
123 .BR e2fsck (8) 
124 executable might be corrupted!  This option is mainly provided
125 for those sysadmins who don't want to repartition the root
126 filesystem to be small and compact (which is really the right solution).
127 .TP
128 .B -s
129 Serialize 
130 .B fsck 
131 operations.  This is a good idea if you checking multiple
132 filesystems and the checkers are in an interactive mode.  (Note:
133 .BR e2fsck (8)
134 runs in an interactive mode by default.  To make 
135 .BR e2fsck (8)
136 run in a non-interactive mode, you must either specify the
137 .B -p
138 or
139 .B -a
140 option, if you wish for errors to be corrected automatically, or
141 the 
142 .B -n
143 option if you do not.)
144 .TP
145 .B -V
146 Produce verbose output, including all file system-specific commands
147 that are executed.
148 .TP
149 .BI -t \ fstype
150 Specifies the type of file system to be checked.  When the
151 .B \-A 
152 flag is specified, only filesystems that match 
153 .I fstype
154 are checked.  If 
155 .I fstype
156 is prefixed with 
157 .B no
158 then only filesystems whose type does not match
159 .I fstype
160 are checked.
161 .sp
162 Normally, the filesystem type is deduced by searching for
163 .I filesys
164 in the 
165 .I /etc/fstab 
166 file and using the corresponding entry.
167 If the type can not be deduced, 
168 .B fsck
169 will use the type specified by the 
170 .B \-t
171 option if it specifies a unique filesystem type.  If this type is not
172 available, then the default file system type (currently ext2) is used. 
173 .TP
174 .B fs-options
175 Any options which are not understood by 
176 .BR fsck ,
177 or which follow the
178 .B --
179 option are treated as file system-specific options to be passed to the
180 file system-specific checker.
181 .PP
182 Currently, standardized file system-specific options are somewhat in
183 flux.  Although not guaranteed, the following options are supported
184 by most file system checkers:
185 .TP
186 .B -a
187 Automatically repair the file system without any questions (use
188 this option with caution).  Note that 
189 .BR e2fsck (8)
190 supports 
191 .B -a
192 for backwards compatibility only.  This option is mapped to 
193 .BR e2fsck 's
194 .B -p
195 option which is safe to use, unlike the 
196 .B -a 
197 option that most file system checkers support.
198 .TP
199 .B -r
200 Interactively repair the filesystem (ask for confirmations).  Note: It
201 is generally a bad idea to use this option if multiple fsck's are being
202 run in parallel.  Also note that this is 
203 .BR e2fsck 's
204 default behavior; it supports this option for backwards compatibility
205 reasons only.
206 .SH AUTHOR
207 Theodore Ts'o (tytso@mit.edu)
208 .PP
209 The manual page was shamelessly adapted from David Engel and Fred van
210 Kempen's generic 
211 .B fsck
212 front end program, which was in turn shamelessly
213 adapted from Remy Card's version for the ext2 file system.
214 .SH FILES
215 .IR /etc/fstab .
216 .SH SEE ALSO
217 .BR fstab (5),
218 .BR mkfs (8),
219 .BR fsck.minix (8),
220 .BR fsck.ext2 (8)
221 or
222 .BR e2fsck (8),
223 .BR fsck.xiafs (8).