Whamcloud - gitweb
Add support for the half-MD4 HTREE hash.
[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 \-sACVRTNP
12 ]
13 [
14 .B \-t
15 .I fstype
16
17 .I filesys [ ... ]
18 [\-\-] [
19 .B fsck-options
20 ]
21 .SH DESCRIPTION
22 .B fsck
23 is used to check and optionally repair a one or more Linux file systems.  
24 .I filesys
25 can be a device name (e.g.
26 .IR /dev/hdc1 ", " /dev/sdb2 ),
27 a mount point (e.g.
28 .IR / ", " /usr ", " /home ),
29 or an ext2 label or UUID specifier (e.g.
30 UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root).  
31 The 
32 .B fsck 
33 program will try to run filesystems on different physical disk drives 
34 in parallel to reduce total amount time to check all of the filesystems.
35 .PP
36 The exit code returned by
37 .B fsck
38 is the sum of the following conditions:
39 .br
40 \       0\      \-\ No errors
41 .br
42 \       1\      \-\ File system errors corrected
43 .br
44 \       2\      \-\ System should be rebooted
45 .br
46 \       4\      \-\ File system errors left uncorrected
47 .br
48 \       8\      \-\ Operational error
49 .br
50 \       16\     \-\ Usage or syntax error
51 .br
52 \       128\    \-\ Shared library error
53 .br
54 The exit code returned when all file systems are checked using the
55 .B \-A
56 option is the bit-wise OR of the exit codes for each
57 file system that is checked.
58 .PP
59 In actuality,
60 .B fsck
61 is simply a front-end for the various file system checkers
62 (\fBfsck\fR.\fIfstype\fR) available under Linux.  The file
63 system-specific checker is searched for in
64 .I /sbin
65 first, then in
66 .I /etc/fs
67 and
68 .IR /etc ,
69 and finally in the directories listed in the PATH environment
70 variable.  Please see the file system-specific checker manual pages for
71 further details.
72 .SH OPTIONS
73 .TP
74 .B \-s
75 Serialize 
76 .B fsck 
77 operations.  This is a good idea if you checking multiple
78 filesystems and the checkers are in an interactive mode.  (Note:
79 .BR e2fsck (8)
80 runs in an interactive mode by default.  To make 
81 .BR e2fsck (8)
82 run in a non-interactive mode, you must either specify the
83 .B \-p
84 or
85 .B \-a
86 option, if you wish for errors to be corrected automatically, or the 
87 .B \-n
88 option if you do not.)
89 .TP
90 .BI \-t " fslist"
91 Specifies the type(s) of file system to be checked.  When the
92 .B \-A 
93 flag is specified, only filesystems that match 
94 .I fslist
95 are checked.  The
96 .I fslist
97 parameter is a comma-separated list of filesystems and options
98 specifiers.  All of the filesystems in this comma-separated list may be
99 prefixed by a negation operator 
100 .RB ' no '
101 or 
102 .RB ' ! ',
103 which requests that only those filesystems not listed in
104 .I fslist
105 will be checked.  If all of the filesystems in 
106 .I fslist
107 are not prefixed by a negation operator, then only those filesystems
108 listed
109 in
110 .I fslist
111 will be checked.
112 .sp
113 Options specifiers may be included in the comma separated
114 .IR fslist .
115 They must have the format 
116 .BI opts= fs-option\fR,
117 and may be prefixed by a negation operator.  If an options specifier is
118 present, then only filesystems whose 
119 .B /etc/fstab
120 entry do (or do not, if the options specifier was prefixed by a negation
121 operator) contain 
122 .I fs-option
123 in their options field of the
124 .B /etc/fstab 
125 file will be checked.
126 .sp
127 For compatibility with Mandrake distributions whose boot scripts
128 depend upon an unauthorized UI change to the
129 .B fsck
130 program, if a filesystem type of
131 .B loop
132 is found in
133 .IR fslist ,
134 it is treated as if
135 .B opts=loop
136 were specified as an argument to the
137 .B \-t
138 option.
139 .sp
140 Normally, the filesystem type is deduced by searching for
141 .I filesys
142 in the 
143 .I /etc/fstab 
144 file and using the corresponding entry.
145 If the type can not be deduced, and there is only a single filesystem 
146 given as an argument to the 
147 .B \-t 
148 option, 
149 .B fsck
150 will use the specified filesystem type.  If this type is not
151 available, then the default file system type (currently ext2) is used. 
152 .TP
153 .B \-A
154 Walk through the
155 .I /etc/fstab
156 file and try to check all file systems in one run.  This option is
157 typically used from the
158 .I /etc/rc
159 system initalization file, instead of multiple commands for checking
160 a single file system.
161 .sp
162 The root filesystem will be checked first unless the
163 .B \-P
164 option is specified (see below).  After that, 
165 filesystems will be checked in the order specified by the 
166 .I fs_passno 
167 (the sixth) field in the 
168 .I /etc/fstab
169 file.  
170 Filesystems with a 
171 .I fs_passno
172 value of 0 are skipped and are not checked at all.  Filesystems with a
173 .I fs_passno
174 value of greater than zero will be checked in order, 
175 with filesystems with the lowest
176 .I fs_passno 
177 number being checked first.
178 If there are multiple filesystems with the same pass number, 
179 fsck will attempt to check them in parallel, although it will avoid running 
180 multiple filesystem checks on the same physical disk.  
181 .sp
182 Hence, a very common configuration in 
183 .I /etc/fstab
184 files is to set the root filesystem to have a 
185 .I fs_passno
186 value of 1
187 and to set all filesystems to have a
188 .I fs_passno
189 value of 2.  This will allow
190 .B fsck
191 to automatically run filesystem checkers in parallel if it is advantageous
192 to do so.  System administrators might choose
193 not to use this configuration if they need to avoid multiple filesystem
194 checks running in parallel for some reason --- for example, if the
195 machine in question is short on memory so that
196 excessive paging is a concern.
197 .TP
198 .B \-C
199 Display completion/progress bars for those filesystems checkers (currently
200 only for ext2) which support them.   Fsck will manage the filesystem checkers
201 so that only one of them will display a progress bar at a time.
202 .TP
203 .B \-N
204 Don't execute, just show what would be done.
205 .TP
206 .B \-P
207 When the 
208 .B \-A
209 flag is set, check the root filesystem in parallel with the other filesystems.
210 This is not the safest thing in the world to do,
211 since if the root filesystem is in doubt things like the 
212 .BR e2fsck (8) 
213 executable might be corrupted!  This option is mainly provided
214 for those sysadmins who don't want to repartition the root
215 filesystem to be small and compact (which is really the right solution).
216 .TP
217 .B \-R
218 When checking all file systems with the
219 .B \-A
220 flag, skip the root file system (in case it's already mounted read-write).
221 .TP
222 .B \-T
223 Don't show the title on startup.
224 .TP
225 .B \-V
226 Produce verbose output, including all file system-specific commands
227 that are executed.
228 .TP
229 .B fsck-options
230 Options which which are not understood by 
231 .B fsck 
232 are passed to the filesystem-specific checker.  These arguments
233 .B must
234 not take arguments, as there is no
235 way for 
236 .B fsck
237 to be able to properly guess which arguments take options and which
238 don't.
239 .IP
240 Options and arguments which follow the
241 .B \-\-
242 are treated as file system-specific options to be passed to the
243 file system-specific checker.
244 .IP
245 Please note that fsck is not
246 designed to pass arbitrarily complicated options to filesystem-specific
247 checkers.  If you're doing something complicated, please just
248 execute the filesystem-specific checker directly.  If you pass 
249 .B fsck
250 some horribly complicated option and arguments, and it doesn't do
251 what you expect, 
252 .B don't bother reporting it as a bug.
253 You're almost certainly doing something that you shouldn't be doing
254 with 
255 .BR fsck.
256 .PP
257 Currently, standardized file system-specific options are somewhat in
258 flux.  Although not guaranteed, the following options are supported
259 by most file system checkers:
260 .TP
261 .B \-a
262 Automatically repair the file system without any questions (use
263 this option with caution).  Note that 
264 .BR e2fsck (8)
265 supports 
266 .B \-a
267 for backwards compatibility only.  This option is mapped to 
268 .BR e2fsck 's
269 .B \-p
270 option which is safe to use, unlike the 
271 .B \-a 
272 option that most file system checkers support.
273 .TP
274 .B \-r
275 Interactively repair the filesystem (ask for confirmations).  Note: It
276 is generally a bad idea to use this option if multiple fsck's are being
277 run in parallel.  Also note that this is 
278 .BR e2fsck 's
279 default behavior; it supports this option for backwards compatibility
280 reasons only.
281 .SH AUTHOR
282 Theodore Ts'o (tytso@mit.edu)
283 .SH FILES
284 .IR /etc/fstab .
285 .SH ENVIRONMENT VARIABLES
286 The
287 .B fsck
288 program's behavior is affected by the following environment variables:
289 .TP
290 .B FSCK_FORCE_ALL_PARALLEL
291 If this environment variable is set, 
292 .B fsck
293 will attempt to run all of the specified filesystems in parallel,
294 regardless of whether the filesystems appear to be on the same
295 device.  (This is useful for RAID systems or high-end storage systems
296 such as those sold by companies such as IBM or EMC.)
297 .TP
298 .B FSCK_MAX_INST
299 This environment variable will limit the maximum number of file system
300 checkers that can be running at one time.  This allows configurations
301 which have a large number of disks to avoid 
302 .B fsck
303 starting too many file system checkers at once, which might overload
304 CPU and memory resources available on the system.  If this value is
305 zero, then an unlimited number of processes can be spawned.  This is
306 currently the default, but future versions of
307 .B fsck
308 may attempt to automatically determine how many file system checks can
309 be run based on gathering accounting data from the operating system.
310 .TP
311 .B PATH
312 The 
313 .B PATH
314 environment variable is used to find file system checkers.  A set of
315 system directories are searched first: 
316 .BR /sbin ,
317 .BR /sbin/fs.d ,
318 .BR  /sbin/fs ,
319 .BR /etc/fs ,
320 and 
321 .BR /etc .
322 Then the set of directories found in the
323 .B PATH
324 environment are searched.
325 .TP
326 .B FSTAB_FILE
327 This environment variable allows the system administrator 
328 to override the standard location of the 
329 .B /etc/fstab
330 file.  It is also use for developers who are testing
331 .BR fsck .
332 .SH SEE ALSO
333 .BR fstab (5),
334 .BR mkfs (8),
335 .BR fsck.minix (8),
336 .BR fsck.ext2 (8)
337 or
338 .BR e2fsck (8),
339 .BR fsck.xiafs (8).