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