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