version 2, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
FSCK |
|
|
2 |
!!!FSCK |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
OPTIONS |
|
|
7 |
AUTHOR |
|
|
8 |
FILES |
|
|
9 |
ENVIRONMENT VARIABLES |
|
|
10 |
SEE ALSO |
|
|
11 |
---- |
|
|
12 |
!!NAME |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
fsck - check and repair a Linux file system |
|
|
16 |
!!SYNOPSIS |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
__fsck__ [[ __-sACVRTNP__ ] [[ __-t__ ''fstype'' ] |
|
|
20 |
''filesys [[ ... ]'' [[--] [[ __fsck-options__ |
|
|
21 |
] |
|
|
22 |
!!DESCRIPTION |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
__fsck__ is used to check and optionally repair a one or |
|
|
26 |
more Linux file systems. ''filesys'' can be a device name |
|
|
27 |
(e.g. ''/dev/hdc1'', ''/dev/sdb2''), a mount point |
|
|
28 |
(e.g. ''/'', ''/usr'', ''/home''), or an ext2 label |
|
|
29 |
or UUID specifier (e.g. |
|
|
30 |
UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). |
|
|
31 |
The __fsck__ program will try to run filesystems on |
|
|
32 |
different physical disk drives in parallel to reduce total |
|
|
33 |
amount time to check all of the filesystems. |
|
|
34 |
|
|
|
35 |
|
|
|
36 |
The exit code returned by __fsck__ is the sum of the |
|
|
37 |
following conditions: |
|
|
38 |
0 - No errors |
|
|
39 |
1 - File system errors corrected |
|
|
40 |
2 - System should be rebooted |
|
|
41 |
4 - File system errors left uncorrected |
|
|
42 |
8 - Operational error |
|
|
43 |
16 - Usage or syntax error |
|
|
44 |
128 - Shared library error |
|
|
45 |
The exit code returned when all file systems are checked |
|
|
46 |
using the __-A__ option is the bit-wise OR of the exit |
|
|
47 |
codes for each file system that is checked. |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
In actuality, __fsck__ is simply a front-end for the |
|
|
51 |
various file system checkers (__fsck__.''fstype'') |
|
|
52 |
available under Linux. The file system-specific checker is |
|
|
53 |
searched for in ''/sbin'' first, then in ''/etc/fs'' |
|
|
54 |
and ''/etc'', and finally in the directories listed in |
|
|
55 |
the PATH environment variable. Please see the file |
|
|
56 |
system-specific checker manual pages for further |
|
|
57 |
details. |
|
|
58 |
!!OPTIONS |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
__-s__ |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
Serialize __fsck__ operations. This is a good idea if you |
|
|
65 |
checking multiple filesystems and the checkers are in an |
2 |
perry |
66 |
interactive mode. (Note: e2fsck(8) runs in an |
|
|
67 |
interactive mode by default. To make e2fsck(8) run in |
1 |
perry |
68 |
a non-interactive mode, you must either specify the |
|
|
69 |
__-p__ or __-a__ option, if you wish for errors to be |
|
|
70 |
corrected automatically, or the __-n__ option if you do |
|
|
71 |
not.) |
|
|
72 |
|
|
|
73 |
|
|
|
74 |
__-t__ ''fslist'' |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
Specifies the type(s) of file system to be checked. When the |
|
|
78 |
__-A__ flag is specified, only filesystems that match |
|
|
79 |
''fslist'' are checked. The ''fslist'' parameter is a |
|
|
80 |
comma-separated list of filesystems and options specifiers. |
|
|
81 |
All of the filesystems in this comma-separated list may be |
|
|
82 |
prefixed by a negation operator '__no__' or '__!__', |
|
|
83 |
which requests that only those filesystems not listed in |
|
|
84 |
''fslist'' will be checked. If all of the filesystems in |
|
|
85 |
''fslist'' are not prefixed by a negation operator, then |
|
|
86 |
only those filesystems listed in ''fslist'' will be |
|
|
87 |
checked. |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
Options specifiers may be included in the comma separated |
|
|
91 |
''fslist''. They must have the format |
|
|
92 |
__opts=__''fs-option'', and may be prefixed by a |
|
|
93 |
negation operator. If an options specifier is present, then |
|
|
94 |
only filesystems whose __/etc/fstab__ entry do (or do |
|
|
95 |
not, if the options specifier was prefixed by a negation |
|
|
96 |
operator) contain ''fs-option'' in their options field of |
|
|
97 |
the __/etc/fstab__ file will be checked. |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
For compatibility with Mandrake distributions whose boot |
|
|
101 |
scripts depend upon an unauthorized UI change to the |
|
|
102 |
__fsck__ program, if a filesystem type of __loop__ is |
|
|
103 |
found in ''fslist'', it is treated as if __opts=loop__ |
|
|
104 |
were specified as an argument to the __-t__ |
|
|
105 |
option. |
|
|
106 |
|
|
|
107 |
|
|
|
108 |
Normally, the filesystem type is deduced by searching for |
|
|
109 |
''filesys'' in the ''/etc/fstab'' file and using the |
|
|
110 |
corresponding entry. If the type can not be deduced, and |
|
|
111 |
there is only a single filesystem given as an argument to |
|
|
112 |
the __-t__ option, __fsck__ will use the specified |
|
|
113 |
filesystem type. If this type is not available, then the |
|
|
114 |
default file system type (currently ext2) is |
|
|
115 |
used. |
|
|
116 |
|
|
|
117 |
|
|
|
118 |
__-A__ |
|
|
119 |
|
|
|
120 |
|
|
|
121 |
Walk through the ''/etc/fstab'' file and try to check all |
|
|
122 |
file systems in one run. This option is typically used from |
|
|
123 |
the ''/etc/rc'' system initalization file, instead of |
|
|
124 |
multiple commands for checking a single file |
|
|
125 |
system. |
|
|
126 |
|
|
|
127 |
|
|
|
128 |
The root filesystem will be checked first unless the |
|
|
129 |
__-P__ option is specified (see below). After that, |
|
|
130 |
filesystems will be checked in the order specified by the |
|
|
131 |
''fs_passno'' (the sixth) field in the ''/etc/fstab'' |
|
|
132 |
file. Filesystems with a ''fs_passno'' value of 0 are |
|
|
133 |
skipped and are not checked at all. Filesystems with a |
|
|
134 |
''fs_passno'' value of greater than zero will be checked |
|
|
135 |
in order, with filesystems with filesystems with the lowest |
|
|
136 |
''fs_passno'' number being checked first. If there are |
|
|
137 |
multiple filesystems with the same pass number, fsck will |
|
|
138 |
attempt to check them in parallel, although it will avoid |
|
|
139 |
running multiple filesystem checks on the same physical |
|
|
140 |
disk. |
|
|
141 |
|
|
|
142 |
|
|
|
143 |
Hence, a very common configuration in ''/etc/fstab'' |
|
|
144 |
files is to set the root filesystem to have a |
|
|
145 |
''fs_passno'' value of 1 and to set all filesystems to |
|
|
146 |
have a ''fs_passno'' value of 2. This will allow |
|
|
147 |
__fsck__ to automatically run filesystem checkers in |
|
|
148 |
parallel if it is advantageous to do so. System |
|
|
149 |
administrators might choose not to use this configuration if |
|
|
150 |
they need to avoid multiple filesystem checks running in |
|
|
151 |
parallel for some reason --- for example, if the machine in |
|
|
152 |
question is short on memory so that excessive paging is a |
|
|
153 |
concern. |
|
|
154 |
|
|
|
155 |
|
|
|
156 |
__-C__ |
|
|
157 |
|
|
|
158 |
|
|
|
159 |
Display completion/progress bars for those filesystems |
|
|
160 |
checkers (currently only for ext2) which support them. Fsck |
|
|
161 |
will manage the filesystem checkers so that only one of them |
|
|
162 |
will display a progress bar at a time. |
|
|
163 |
|
|
|
164 |
|
|
|
165 |
__-N__ |
|
|
166 |
|
|
|
167 |
|
|
|
168 |
Don't execute, just show what would be done. |
|
|
169 |
|
|
|
170 |
|
|
|
171 |
__-P__ |
|
|
172 |
|
|
|
173 |
|
|
|
174 |
When the __-A__ flag is set, check the root filesystem in |
|
|
175 |
parallel with the other filesystems. This is not the safest |
|
|
176 |
thing in the world to do, since if the root filesystem is in |
2 |
perry |
177 |
doubt things like the e2fsck(8) executable might be |
1 |
perry |
178 |
corrupted! This option is mainly provided for those |
|
|
179 |
sysadmins who don't want to repartition the root filesystem |
|
|
180 |
to be small and compact (which is really the right |
|
|
181 |
solution). |
|
|
182 |
|
|
|
183 |
|
|
|
184 |
__-R__ |
|
|
185 |
|
|
|
186 |
|
|
|
187 |
When checking all file systems with the __-A__ flag, skip |
|
|
188 |
the root file system (in case it's already mounted |
|
|
189 |
read-write). |
|
|
190 |
|
|
|
191 |
|
|
|
192 |
__-T__ |
|
|
193 |
|
|
|
194 |
|
|
|
195 |
Don't show the title on startup. |
|
|
196 |
|
|
|
197 |
|
|
|
198 |
__-V__ |
|
|
199 |
|
|
|
200 |
|
|
|
201 |
Produce verbose output, including all file system-specific |
|
|
202 |
commands that are executed. |
|
|
203 |
|
|
|
204 |
|
|
|
205 |
__fsck-options__ |
|
|
206 |
|
|
|
207 |
|
|
|
208 |
Options which which are not understood by __fsck__ are |
|
|
209 |
passed to the filesystem-specific checker. These arguments |
|
|
210 |
__must__ not take arguments, as there is no way for |
|
|
211 |
__fsck__ to be able to properly guess which arguments |
|
|
212 |
take options and which don't. |
|
|
213 |
|
|
|
214 |
|
|
|
215 |
Options and arguments which follow the __--__ are treated |
|
|
216 |
as file system-specific options to be passed to the file |
|
|
217 |
system-specific checker. |
|
|
218 |
|
|
|
219 |
|
|
|
220 |
Please note that fsck is not designed to pass arbitrarily |
|
|
221 |
complicated options to filesystem-specific checkers. If |
|
|
222 |
you're doing something complicated, please just execute the |
|
|
223 |
filesystem-specific checker directly. If you pass |
|
|
224 |
__fsck__ some horribly complicated option and arguments, |
|
|
225 |
and it doesn't do what you expect, __don't bother reporting |
|
|
226 |
it as a bug.__ You're almost certainly doing something |
|
|
227 |
that you shouldn't be doing with __fsck.__ |
|
|
228 |
|
|
|
229 |
|
|
|
230 |
Currently, standardized file system-specific options are |
|
|
231 |
somewhat in flux. Although not guaranteed, the following |
|
|
232 |
options are supported by most file system |
|
|
233 |
checkers: |
|
|
234 |
|
|
|
235 |
|
|
|
236 |
__-a__ |
|
|
237 |
|
|
|
238 |
|
|
|
239 |
Automatically repair the file system without any questions |
2 |
perry |
240 |
(use this option with caution). Note that e2fsck(8) |
1 |
perry |
241 |
supports __-a__ for backwards compatibility only. This |
|
|
242 |
option is mapped to __e2fsck__'s __-p__ option which |
|
|
243 |
is safe to use, unlike the __-a__ option that most file |
|
|
244 |
system checkers support. |
|
|
245 |
|
|
|
246 |
|
|
|
247 |
__-r__ |
|
|
248 |
|
|
|
249 |
|
|
|
250 |
Interactively repair the filesystem (ask for confirmations). |
|
|
251 |
Note: It is generally a bad idea to use this option if |
|
|
252 |
multiple fsck's are being run in parallel. Also note that |
|
|
253 |
this is __e2fsck__'s default behavior; it supports this |
|
|
254 |
option for backwards compatibility reasons |
|
|
255 |
only. |
|
|
256 |
!!AUTHOR |
|
|
257 |
|
|
|
258 |
|
|
|
259 |
Theodore Ts'o (tytso@mit.edu) |
|
|
260 |
!!FILES |
|
|
261 |
|
|
|
262 |
|
|
|
263 |
''/etc/fstab''. |
|
|
264 |
!!ENVIRONMENT VARIABLES |
|
|
265 |
|
|
|
266 |
|
|
|
267 |
The __fsck__ program's behavior is affected by the |
|
|
268 |
following environment variables: |
|
|
269 |
|
|
|
270 |
|
|
|
271 |
__FSCK_FORCE_ALL_PARALLEL__ |
|
|
272 |
|
|
|
273 |
|
|
|
274 |
If this environment variable is set, __fsck__ will |
|
|
275 |
attempt to run all of the specified filesystems in parallel, |
|
|
276 |
regardless of whether the filesystems appear to be on the |
|
|
277 |
same device. (This is useful for RAID systems or high-end |
|
|
278 |
storage systems such as those sold by companies such as IBM |
|
|
279 |
or EMC.) |
|
|
280 |
|
|
|
281 |
|
|
|
282 |
__FSCK_MAX_INST__ |
|
|
283 |
|
|
|
284 |
|
|
|
285 |
This environment variable will limit the maximum number of |
|
|
286 |
file system checkers that can be running at one time. This |
|
|
287 |
allows configurations which have a large number of disks to |
|
|
288 |
avoid __fsck__ starting too many file system checkers at |
|
|
289 |
once, which might overload CPU and memory resources |
|
|
290 |
available on the system. If this value is zero, then an |
|
|
291 |
unlimited number of processes can be spawned. This is |
|
|
292 |
currently the default, but future versions of __fsck__ |
|
|
293 |
may attempt to automatically determine how many file system |
|
|
294 |
checks can be run based on gathering accounting data from |
|
|
295 |
the operating system. |
|
|
296 |
|
|
|
297 |
|
|
|
298 |
__PATH__ |
|
|
299 |
|
|
|
300 |
|
|
|
301 |
The __PATH__ environment variable is used to find file |
|
|
302 |
system checkers. A set of system directories are searched |
|
|
303 |
first: __/sbin__, __/sbin/fs.d__, __/sbin/fs__, |
|
|
304 |
__/etc/fs__, and __/etc__. Then the set of directories |
|
|
305 |
found in the __PATH__ environment are |
|
|
306 |
searched. |
|
|
307 |
|
|
|
308 |
|
|
|
309 |
__FSTAB_FILE__ |
|
|
310 |
|
|
|
311 |
|
|
|
312 |
This environment variable allows the system administrator to |
|
|
313 |
override the standard location of the __/etc/fstab__ |
|
|
314 |
file. It is also use for developers who are testing |
|
|
315 |
__fsck__. |
|
|
316 |
!!SEE ALSO |
|
|
317 |
|
|
|
318 |
|
2 |
perry |
319 |
fstab(5), mkfs(8), fsck.minix(8), |
|
|
320 |
fsck.ext2(8) or __e2fsck__(8), |
|
|
321 |
fsck.xiafs(8). |
1 |
perry |
322 |
---- |