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