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