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