Whamcloud - gitweb
fsck.8.in: Add much more explicit language documenting how the
[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 .B fsck-options
18 ]
19 .I filesys [ ... ]
20 .SH DESCRIPTION
21 .B fsck
22 is used to check and optionally repair a one or more Linux file systems.  
23 .I filesys
24 can be a device name (e.g.
25 .IR /dev/hdc1 ", " /dev/sdb2 ),
26 a mount point (e.g.
27 .IR / ", " /usr ", " /home ),
28 or an ext2 label or UUID specifier (e.g.
29 UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root).  
30 The 
31 .B fsck 
32 program will try to run filesystems on different physical disk drives 
33 in parallel to reduce total amount time to check all of the filesystems.
34 .PP
35 The exit code returned by
36 .B fsck
37 is the sum of the following conditions:
38 .br
39 \       0\      \-\ No errors
40 .br
41 \       1\      \-\ File system errors corrected
42 .br
43 \       2\      \-\ System should be rebooted
44 .br
45 \       4\      \-\ File system errors left uncorrected
46 .br
47 \       8\      \-\ Operational error
48 .br
49 \       16\     \-\ Usage or syntax error
50 .br
51 \       128\    \-\ Shared library error
52 .br
53 The exit code returned when all file systems are checked using the
54 .B \-A
55 option is the bit-wise OR of the exit codes for each
56 file system that is checked.
57 .PP
58 In actuality,
59 .B fsck
60 is simply a front-end for the various file system checkers
61 (\fBfsck\fR.\fIfstype\fR) available under Linux.  The file
62 system-specific checker is searched for in
63 .I /sbin
64 first, then in
65 .I /etc/fs
66 and
67 .IR /etc ,
68 and finally in the directories listed in the PATH environment
69 variable.  Please see the file system-specific checker manual pages for
70 further details.
71 .SH OPTIONS
72 .TP
73 .B \-s
74 Serialize 
75 .B fsck 
76 operations.  This is a good idea if you checking multiple
77 filesystems and the checkers are in an interactive mode.  (Note:
78 .BR e2fsck (8)
79 runs in an interactive mode by default.  To make 
80 .BR e2fsck (8)
81 run in a non-interactive mode, you must either specify the
82 .B \-p
83 or
84 .B \-a
85 option, if you wish for errors to be corrected automatically, or the 
86 .B \-n
87 option if you do not.)
88 .TP
89 .BI \-t " fslist"
90 Specifies the type(s) of file system to be checked.  When the
91 .B \-A 
92 flag is specified, only filesystems that match 
93 .I fslist
94 are checked.  The
95 .I fslist
96 parameter is a comma-separated list of filesystems and options
97 specifiers.  All of the filesystems in this comma-separated list may be
98 prefixed by a negation operator 
99 .RB ' no '
100 or 
101 .RB ' ! ',
102 which requests that only those filesystems not listed in
103 .I fslist
104 will be checked.  If all of the filesystems in 
105 .I fslist
106 are not prefixed by a negation operator, then only those filesystems
107 listed
108 in
109 .I fslist
110 will be checked.
111 .sp
112 Options specifiers may be included in the comma separated
113 .IR fslist .
114 They must have the format 
115 .BI opts= fs-option\fR,
116 and may be prefixed by a negation operator.  If an options specifier is
117 present, then only filesystems whose 
118 .B /etc/fstab
119 entry do (or do not, if the options specifier was prefixed by a negation
120 operator) contain 
121 .I fs-option
122 in their options field of the
123 .B /etc/fstab 
124 file will be checked.
125 .sp
126 For compatibility with Mandrake distributions whose boot scripts
127 depend upon an unauthorized UI change to the
128 .B fsck
129 program, if a filesystem type of
130 .B loop
131 is found in
132 .IR fslist ,
133 it is treated as if
134 .B opts=loop
135 were specified as an argument to the
136 .B \-t
137 option.
138 .sp
139 Normally, the filesystem type is deduced by searching for
140 .I filesys
141 in the 
142 .I /etc/fstab 
143 file and using the corresponding entry.
144 If the type can not be deduced, and there is only a single filesystem 
145 given as an argument to the 
146 .B \-t 
147 option, 
148 .B fsck
149 will use the specified filesystem type.  If this type is not
150 available, then the default file system type (currently ext2) is used. 
151 .TP
152 .B \-A
153 Walk through the
154 .I /etc/fstab
155 file and try to check all file systems in one run.  This option is
156 typically used from the
157 .I /etc/rc
158 system initalization file, instead of multiple commands for checking
159 a single file system.
160 .sp
161 The root filesystem will be checked first unless the
162 .B \-P
163 option is specified (see below).  After that, 
164 filesystems will be checked in the order specified by the 
165 .I fs_passno 
166 (the sixth) field in the 
167 .I /etc/fstab
168 file.  
169 Filesystems with a 
170 .I fs_passno
171 value of 0 are skipped and are not checked at all.  Filesystems with a
172 .I fs_passno
173 value of greater than zero will be checked in order, with filesystems
174 with filesystems with the lowest
175 .I fs_passno 
176 number being checked first.
177 If there are multiple filesystems with the same pass number, 
178 fsck will attempt to check them in parallel, although it will avoid running 
179 multiple filesystem checks on the same physical disk.  
180 .sp
181 Hence, a very common configuration in 
182 .I /etc/fstab
183 files is to set the root filesystem to have a 
184 .I fs_passno
185 value of 1
186 and to set all filesystems to have a
187 .I fs_passno
188 value of 2.  This will allow
189 .B fsck
190 to automatically run filesystem checkers in parallel if it is advantageous
191 to do so.  System administrators might choose
192 not to use this configuration if they need to avoid multiple filesystem
193 checks running in parallel for some reason --- for example, if the
194 machine in question is short on memory so that
195 excessive paging is a concern.
196 .TP
197 .B \-C
198 Display completion/progress bars for those filesystems checkers (currently
199 only for ext2) which support them.   Fsck will manage the filesystem checkers
200 so that only one of them will display a progress bar at a time.
201 .TP
202 .B \-N
203 Don't execute, just show what would be done.
204 .TP
205 .B \-P
206 When the 
207 .B \-A
208 flag is set, check the root filesystem in parallel with the other filesystems.
209 This is not the safest thing in the world to do,
210 since if the root filesystem is in doubt things like the 
211 .BR e2fsck (8) 
212 executable might be corrupted!  This option is mainly provided
213 for those sysadmins who don't want to repartition the root
214 filesystem to be small and compact (which is really the right solution).
215 .TP
216 .B \-R
217 When checking all file systems with the
218 .B \-A
219 flag, skip the root file system (in case it's already mounted read-write).
220 .TP
221 .B \-T
222 Don't show the title on startup.
223 .TP
224 .B \-V
225 Produce verbose output, including all file system-specific commands
226 that are executed.
227 .TP
228 .B fsck-options
229 Options which which are not understood by 
230 .B fsck 
231 are passed to the filesystem-specific checker.  These arguments
232 .B must
233 not take arguments, as there is no
234 way for 
235 .B fsck
236 to be able to properly guess which arguments take options and which
237 don't.
238 .IP
239 Options and arguments which follow the
240 .B \-\-
241 are treated as file system-specific options to be passed to the
242 file system-specific checker.
243 .IP
244 Please note that fsck is not
245 designed to pass arbitrarily complicated options to filesystem-specific
246 checkers.  If you're doing something complicated, please just
247 execute the filesystem-specific checker directly.  If you pass 
248 .B fsck
249 some horribly complicated option and arguments, and it doesn't do
250 what you expect, 
251 .B don't bother reporting it as a bug.
252 You're almost certainly doing something that you shouldn't be doing
253 with 
254 .BR fsck.
255 .PP
256 Currently, standardized file system-specific options are somewhat in
257 flux.  Although not guaranteed, the following options are supported
258 by most file system checkers:
259 .TP
260 .B \-a
261 Automatically repair the file system without any questions (use
262 this option with caution).  Note that 
263 .BR e2fsck (8)
264 supports 
265 .B \-a
266 for backwards compatibility only.  This option is mapped to 
267 .BR e2fsck 's
268 .B \-p
269 option which is safe to use, unlike the 
270 .B \-a 
271 option that most file system checkers support.
272 .TP
273 .B \-r
274 Interactively repair the filesystem (ask for confirmations).  Note: It
275 is generally a bad idea to use this option if multiple fsck's are being
276 run in parallel.  Also note that this is 
277 .BR e2fsck 's
278 default behavior; it supports this option for backwards compatibility
279 reasons only.
280 .SH AUTHOR
281 Theodore Ts'o (tytso@mit.edu)
282 .PP
283 The manual page was shamelessly adapted from David Engel and Fred van
284 Kempen's generic 
285 .B fsck
286 front end program, which was in turn shamelessly
287 adapted from Remy Card's version for the ext2 file system.
288 .SH FILES
289 .IR /etc/fstab .
290 .SH SEE ALSO
291 .BR fstab (5),
292 .BR mkfs (8),
293 .BR fsck.minix (8),
294 .BR fsck.ext2 (8)
295 or
296 .BR e2fsck (8),
297 .BR fsck.xiafs (8).