OSDN Git Service

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