]>
Commit | Line | Data |
---|---|---|
607c2a72 KZ |
1 | .\" Copyright 1993, 1994, 1995 by Theodore Ts'o. All Rights Reserved. |
2 | .\" This file may be copied under the terms of the GNU Public License. | |
c45b8d6a | 3 | .\" |
232dc924 | 4 | .TH FSCK 8 "February 2009" "util-linux" "System Administration" |
607c2a72 | 5 | .SH NAME |
92623f46 | 6 | fsck \- check and repair a Linux filesystem |
607c2a72 KZ |
7 | .SH SYNOPSIS |
8 | .B fsck | |
07c09a29 SB |
9 | .RB [ \-lsAVRTMNP ] |
10 | .RB [ \-r | |
11 | .RI [ fd ]] | |
c45b8d6a PB |
12 | .RB [ \-C |
13 | .RI [ fd ]] | |
14 | .RB [ \-t | |
15 | .IR fstype ] | |
dbaa5fda | 16 | .RI [ filesystem \&...\&] |
c45b8d6a PB |
17 | .RB [ \-\- ] |
18 | .RI [ fs-specific-options ] | |
607c2a72 KZ |
19 | .SH DESCRIPTION |
20 | .B fsck | |
92623f46 | 21 | is used to check and optionally repair one or more Linux filesystems. |
607c2a72 KZ |
22 | .I filesys |
23 | can be a device name (e.g. | |
24 | .IR /dev/hdc1 ", " /dev/sdb2 ), | |
25 | a mount point (e.g. | |
26 | .IR / ", " /usr ", " /home ), | |
4534e4f2 | 27 | or an filesystem label or UUID specifier (e.g. |
c45b8d6a PB |
28 | UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). |
29 | Normally, the | |
30 | .B fsck | |
31 | program will try to handle filesystems on different physical disk drives | |
92623f46 | 32 | in parallel to reduce the total amount of time needed to check all of them. |
607c2a72 | 33 | .PP |
c45b8d6a PB |
34 | If no filesystems are specified on the command line, and the |
35 | .B \-A | |
36 | option is not specified, | |
607c2a72 KZ |
37 | .B fsck |
38 | will default to checking filesystems in | |
46f057ed | 39 | .I /etc/fstab |
c45b8d6a | 40 | serially. This is equivalent to the |
607c2a72 KZ |
41 | .B \-As |
42 | options. | |
43 | .PP | |
44 | The exit code returned by | |
45 | .B fsck | |
46 | is the sum of the following conditions: | |
fdbc2509 SK |
47 | .PP |
48 | .RS | |
49 | .PD 0 | |
50 | .TP | |
51 | .B 0 | |
52 | No errors | |
53 | .TP | |
54 | .B 1 | |
55 | Filesystem errors corrected | |
56 | .TP | |
57 | .B 2 | |
58 | System should be rebooted | |
59 | .TP | |
60 | .B 4 | |
61 | Filesystem errors left uncorrected | |
62 | .TP | |
63 | .B 8 | |
64 | Operational error | |
65 | .TP | |
66 | .B 16 | |
67 | Usage or syntax error | |
68 | .TP | |
69 | .B 32 | |
de8f5483 | 70 | Checking canceled by user request |
fdbc2509 SK |
71 | .TP |
72 | .B 128 | |
73 | Shared-library error | |
74 | .PD | |
75 | .RE | |
76 | .PP | |
92623f46 | 77 | The exit code returned when multiple filesystems are checked |
607c2a72 | 78 | is the bit-wise OR of the exit codes for each |
92623f46 | 79 | filesystem that is checked. |
607c2a72 KZ |
80 | .PP |
81 | In actuality, | |
82 | .B fsck | |
92623f46 BS |
83 | is simply a front-end for the various filesystem checkers |
84 | (\fBfsck\fR.\fIfstype\fR) available under Linux. The | |
a03bdbcd KZ |
85 | filesystem-specific checker is searched for in the |
86 | PATH environment variable. If the PATH is undefined then | |
87 | fallback to "/sbin". | |
88 | .PP | |
89 | Please see the filesystem-specific checker manual pages for | |
607c2a72 KZ |
90 | further details. |
91 | .SH OPTIONS | |
92 | .TP | |
dd0bd943 | 93 | .B \-l |
3bbdae63 KZ |
94 | Create an exclusive |
95 | .BR flock (2) | |
96 | lock file (/run/fsck/<diskname>.lock) for whole-disk device. | |
dbaa5fda BIG |
97 | This option can be used with one device only (this means that \fB\-A\fR and |
98 | \fB\-l\fR are mutually exclusive). This option is recommended when more | |
8323d9fd | 99 | .BR fsck (8) |
92623f46 BS |
100 | instances are executed in the same time. The option is ignored when used for |
101 | multiple devices or for non-rotating disks. \fBfsck\fR does not lock underlying | |
dbaa5fda | 102 | devices when executed to check stacked devices (e.g.\& MD or DM) \(en this feature is |
dd0bd943 KZ |
103 | not implemented yet. |
104 | .TP | |
07c09a29 | 105 | .BR \-r \ [ \fIfd\fR ] |
dbaa5fda | 106 | Report certain statistics for each fsck when it completes. These statistics |
5a0da00a | 107 | include the exit status, the maximum run set size (in kilobytes), the elapsed |
dbaa5fda | 108 | all-clock time and the user and system CPU time used by the fsck run. For |
5a0da00a FM |
109 | example: |
110 | ||
0556def4 | 111 | /dev/sda1: status 0, rss 92828, real 4.002804, user 2.677592, sys 0.86186 |
07c09a29 SB |
112 | |
113 | GUI front-ends may specify a file descriptor | |
114 | .IR fd , | |
115 | in which case the progress bar information will be sent to that file descriptor | |
d35df4db | 116 | in a machine parsable format. For example: |
07c09a29 SB |
117 | |
118 | /dev/sda1 0 92828 4.002804 2.677592 0.86186 | |
5a0da00a | 119 | .TP |
607c2a72 | 120 | .B \-s |
c45b8d6a PB |
121 | Serialize |
122 | .B fsck | |
607c2a72 KZ |
123 | operations. This is a good idea if you are checking multiple |
124 | filesystems and the checkers are in an interactive mode. (Note: | |
125 | .BR e2fsck (8) | |
c45b8d6a | 126 | runs in an interactive mode by default. To make |
607c2a72 KZ |
127 | .BR e2fsck (8) |
128 | run in a non-interactive mode, you must either specify the | |
129 | .B \-p | |
130 | or | |
131 | .B \-a | |
c45b8d6a | 132 | option, if you wish for errors to be corrected automatically, or the |
607c2a72 KZ |
133 | .B \-n |
134 | option if you do not.) | |
135 | .TP | |
136 | .BI \-t " fslist" | |
92623f46 | 137 | Specifies the type(s) of filesystem to be checked. When the |
c45b8d6a PB |
138 | .B \-A |
139 | flag is specified, only filesystems that match | |
607c2a72 KZ |
140 | .I fslist |
141 | are checked. The | |
142 | .I fslist | |
143 | parameter is a comma-separated list of filesystems and options | |
144 | specifiers. All of the filesystems in this comma-separated list may be | |
c45b8d6a | 145 | prefixed by a negation operator |
607c2a72 | 146 | .RB ' no ' |
c45b8d6a | 147 | or |
607c2a72 KZ |
148 | .RB ' ! ', |
149 | which requests that only those filesystems not listed in | |
150 | .I fslist | |
92623f46 | 151 | will be checked. If none of the filesystems in |
607c2a72 | 152 | .I fslist |
92623f46 | 153 | is prefixed by a negation operator, then only those listed filesystems |
607c2a72 KZ |
154 | will be checked. |
155 | .sp | |
156 | Options specifiers may be included in the comma-separated | |
157 | .IR fslist . | |
c45b8d6a | 158 | They must have the format |
607c2a72 KZ |
159 | .BI opts= fs-option\fR. |
160 | If an options specifier is present, then only filesystems which contain | |
161 | .I fs-option | |
c45b8d6a | 162 | in their mount options field of |
46f057ed | 163 | .I /etc/fstab |
607c2a72 | 164 | will be checked. If the options specifier is prefixed by a negation |
c45b8d6a | 165 | operator, then only |
607c2a72 KZ |
166 | those filesystems that do not have |
167 | .I fs-option | |
168 | in their mount options field of | |
46f057ed | 169 | .I /etc/fstab |
607c2a72 KZ |
170 | will be checked. |
171 | .sp | |
172 | For example, if | |
173 | .B opts=ro | |
174 | appears in | |
175 | .IR fslist , | |
176 | then only filesystems listed in | |
46f057ed | 177 | .I /etc/fstab |
607c2a72 KZ |
178 | with the |
179 | .B ro | |
180 | option will be checked. | |
181 | .sp | |
182 | For compatibility with Mandrake distributions whose boot scripts | |
183 | depend upon an unauthorized UI change to the | |
184 | .B fsck | |
185 | program, if a filesystem type of | |
186 | .B loop | |
187 | is found in | |
188 | .IR fslist , | |
189 | it is treated as if | |
190 | .B opts=loop | |
191 | were specified as an argument to the | |
192 | .B \-t | |
193 | option. | |
194 | .sp | |
195 | Normally, the filesystem type is deduced by searching for | |
196 | .I filesys | |
c45b8d6a PB |
197 | in the |
198 | .I /etc/fstab | |
607c2a72 | 199 | file and using the corresponding entry. |
223939d9 | 200 | If the type cannot be deduced, and there is only a single filesystem |
c45b8d6a PB |
201 | given as an argument to the |
202 | .B \-t | |
203 | option, | |
607c2a72 KZ |
204 | .B fsck |
205 | will use the specified filesystem type. If this type is not | |
92623f46 | 206 | available, then the default filesystem type (currently ext2) is used. |
607c2a72 KZ |
207 | .TP |
208 | .B \-A | |
209 | Walk through the | |
210 | .I /etc/fstab | |
92623f46 | 211 | file and try to check all filesystems in one run. This option is |
607c2a72 KZ |
212 | typically used from the |
213 | .I /etc/rc | |
214 | system initialization file, instead of multiple commands for checking | |
92623f46 | 215 | a single filesystem. |
607c2a72 KZ |
216 | .sp |
217 | The root filesystem will be checked first unless the | |
218 | .B \-P | |
c45b8d6a PB |
219 | option is specified (see below). After that, |
220 | filesystems will be checked in the order specified by the | |
221 | .I fs_passno | |
222 | (the sixth) field in the | |
607c2a72 | 223 | .I /etc/fstab |
c45b8d6a PB |
224 | file. |
225 | Filesystems with a | |
607c2a72 KZ |
226 | .I fs_passno |
227 | value of 0 are skipped and are not checked at all. Filesystems with a | |
228 | .I fs_passno | |
c45b8d6a | 229 | value of greater than zero will be checked in order, |
607c2a72 | 230 | with filesystems with the lowest |
c45b8d6a | 231 | .I fs_passno |
607c2a72 | 232 | number being checked first. |
c45b8d6a | 233 | If there are multiple filesystems with the same pass number, |
de8f5483 BS |
234 | .B fsck |
235 | will attempt to check them in parallel, although it will avoid running | |
c45b8d6a | 236 | multiple filesystem checks on the same physical disk. |
607c2a72 | 237 | .sp |
0c0f93fc | 238 | .B fsck |
dbaa5fda | 239 | does not check stacked devices (RAIDs, dm-crypt, \&...\&) in parallel with any other |
92623f46 | 240 | device. See below for FSCK_FORCE_ALL_PARALLEL setting. The /sys filesystem is |
d35df4db | 241 | used to determine dependencies between devices. |
0c0f93fc | 242 | .sp |
c45b8d6a | 243 | Hence, a very common configuration in |
607c2a72 | 244 | .I /etc/fstab |
c45b8d6a | 245 | files is to set the root filesystem to have a |
607c2a72 KZ |
246 | .I fs_passno |
247 | value of 1 | |
248 | and to set all other filesystems to have a | |
249 | .I fs_passno | |
250 | value of 2. This will allow | |
251 | .B fsck | |
252 | to automatically run filesystem checkers in parallel if it is advantageous | |
253 | to do so. System administrators might choose | |
254 | not to use this configuration if they need to avoid multiple filesystem | |
dbaa5fda | 255 | checks running in parallel for some reason \(en for example, if the |
607c2a72 KZ |
256 | machine in question is short on memory so that |
257 | excessive paging is a concern. | |
0779255c LN |
258 | .sp |
259 | .B fsck | |
260 | normally does not check whether the device actually exists before | |
92623f46 BS |
261 | calling a filesystem specific checker. Therefore non-existing |
262 | devices may cause the system to enter filesystem repair mode during | |
263 | boot if the filesystem specific checker returns a fatal error. The | |
46f057ed | 264 | .I /etc/fstab |
0779255c LN |
265 | mount option |
266 | .B nofail | |
267 | may be used to have | |
268 | .B fsck | |
269 | skip non-existing devices. | |
270 | .B fsck | |
92623f46 | 271 | also skips non-existing devices that have the special filesystem type |
fdbc2509 | 272 | .BR auto . |
607c2a72 | 273 | .TP |
de8f5483 | 274 | .BR \-C \ [ \fIfd\fR ] |
c45b8d6a | 275 | Display completion/progress bars for those filesystem checkers (currently |
9fbf8783 | 276 | only for ext[234]) which support them. \fBfsck\fR will manage the |
c45b8d6a | 277 | filesystem checkers so that only one of them will display |
607c2a72 KZ |
278 | a progress bar at a time. GUI front-ends may specify a file descriptor |
279 | .IR fd , | |
280 | in which case the progress bar information will be sent to that file descriptor. | |
281 | .TP | |
282 | .B \-M | |
283 | Do not check mounted filesystems and return an exit code of 0 | |
284 | for mounted filesystems. | |
285 | .TP | |
286 | .B \-N | |
287 | Don't execute, just show what would be done. | |
288 | .TP | |
289 | .B \-P | |
c45b8d6a | 290 | When the |
607c2a72 KZ |
291 | .B \-A |
292 | flag is set, check the root filesystem in parallel with the other filesystems. | |
293 | This is not the safest thing in the world to do, | |
c45b8d6a PB |
294 | since if the root filesystem is in doubt things like the |
295 | .BR e2fsck (8) | |
607c2a72 KZ |
296 | executable might be corrupted! This option is mainly provided |
297 | for those sysadmins who don't want to repartition the root | |
298 | filesystem to be small and compact (which is really the right solution). | |
299 | .TP | |
300 | .B \-R | |
92623f46 | 301 | When checking all filesystems with the |
607c2a72 | 302 | .B \-A |
92623f46 BS |
303 | flag, skip the root filesystem. (This is useful in case the root |
304 | filesystem has already been mounted read-write.) | |
607c2a72 KZ |
305 | .TP |
306 | .B \-T | |
307 | Don't show the title on startup. | |
308 | .TP | |
309 | .B \-V | |
92623f46 | 310 | Produce verbose output, including all filesystem-specific commands |
607c2a72 | 311 | that are executed. |
58745f35 RM |
312 | .TP |
313 | \fB\-?\fR, \fB\-\-help\fR | |
314 | Display help text and exit. | |
315 | .TP | |
316 | \fB\-\-version\fR | |
317 | Display version information and exit. | |
7208ef86 | 318 | .SH FILESYSTEM SPECIFIC OPTIONS |
2bb3aa36 | 319 | .B Options which are not understood by fsck are passed to the filesystem-specific checker! |
7208ef86 KZ |
320 | .PP |
321 | These options | |
607c2a72 KZ |
322 | .B must |
323 | not take arguments, as there is no | |
c45b8d6a | 324 | way for |
607c2a72 | 325 | .B fsck |
92623f46 | 326 | to be able to properly guess which options take arguments and which |
607c2a72 | 327 | don't. |
7208ef86 | 328 | .PP |
607c2a72 KZ |
329 | Options and arguments which follow the |
330 | .B \-\- | |
92623f46 BS |
331 | are treated as filesystem-specific options to be passed to the |
332 | filesystem-specific checker. | |
7208ef86 | 333 | .PP |
de8f5483 | 334 | Please note that \fBfsck\fR is not |
607c2a72 KZ |
335 | designed to pass arbitrarily complicated options to filesystem-specific |
336 | checkers. If you're doing something complicated, please just | |
c45b8d6a | 337 | execute the filesystem-specific checker directly. If you pass |
607c2a72 | 338 | .B fsck |
92623f46 | 339 | some horribly complicated options and arguments, and it doesn't do |
c45b8d6a | 340 | what you expect, |
607c2a72 KZ |
341 | .B don't bother reporting it as a bug. |
342 | You're almost certainly doing something that you shouldn't be doing | |
c45b8d6a | 343 | with |
dbaa5fda | 344 | .BR fsck . |
607c2a72 | 345 | Options to different filesystem-specific fsck's are not standardized. |
607c2a72 | 346 | .SH FILES |
0bb7e904 | 347 | .I /etc/fstab |
607c2a72 KZ |
348 | .SH ENVIRONMENT VARIABLES |
349 | The | |
350 | .B fsck | |
351 | program's behavior is affected by the following environment variables: | |
352 | .TP | |
353 | .B FSCK_FORCE_ALL_PARALLEL | |
c45b8d6a | 354 | If this environment variable is set, |
607c2a72 | 355 | .B fsck |
92623f46 | 356 | will attempt to check all of the specified filesystems in parallel, regardless of |
0c0f93fc KZ |
357 | whether the filesystems appear to be on the same device. (This is useful for |
358 | RAID systems or high-end storage systems such as those sold by companies such | |
92623f46 | 359 | as IBM or EMC.) Note that the fs_passno value is still used. |
607c2a72 KZ |
360 | .TP |
361 | .B FSCK_MAX_INST | |
92623f46 | 362 | This environment variable will limit the maximum number of filesystem |
607c2a72 | 363 | checkers that can be running at one time. This allows configurations |
c45b8d6a | 364 | which have a large number of disks to avoid |
607c2a72 | 365 | .B fsck |
92623f46 | 366 | starting too many filesystem checkers at once, which might overload |
607c2a72 KZ |
367 | CPU and memory resources available on the system. If this value is |
368 | zero, then an unlimited number of processes can be spawned. This is | |
369 | currently the default, but future versions of | |
370 | .B fsck | |
92623f46 | 371 | may attempt to automatically determine how many filesystem checks can |
607c2a72 KZ |
372 | be run based on gathering accounting data from the operating system. |
373 | .TP | |
374 | .B PATH | |
c45b8d6a | 375 | The |
607c2a72 | 376 | .B PATH |
a03bdbcd | 377 | environment variable is used to find filesystem checkers. |
607c2a72 KZ |
378 | .TP |
379 | .B FSTAB_FILE | |
c45b8d6a PB |
380 | This environment variable allows the system administrator |
381 | to override the standard location of the | |
46f057ed | 382 | .I /etc/fstab |
607c2a72 KZ |
383 | file. It is also useful for developers who are testing |
384 | .BR fsck . | |
ddfeda98 | 385 | .TP |
68e422ec KZ |
386 | .B LIBBLKID_DEBUG=all |
387 | enables libblkid debug output. | |
ca3dbca1 | 388 | .TP |
68e422ec | 389 | .B LIBMOUNT_DEBUG=all |
24930e70 | 390 | enables libmount debug output. |
607c2a72 | 391 | .SH SEE ALSO |
dbaa5fda | 392 | .na |
607c2a72 KZ |
393 | .BR fstab (5), |
394 | .BR mkfs (8), | |
395 | .BR fsck.ext2 (8) | |
396 | or | |
397 | .BR fsck.ext3 (8) | |
398 | or | |
399 | .BR e2fsck (8), | |
dbeb1d73 | 400 | .BR fsck.cramfs (8), |
607c2a72 KZ |
401 | .BR fsck.jfs (8), |
402 | .BR fsck.nfs (8), | |
f053ff1e MK |
403 | .BR fsck.minix (8), |
404 | .BR fsck.msdos (8), | |
607c2a72 KZ |
405 | .BR fsck.vfat (8), |
406 | .BR fsck.xfs (8), | |
f053ff1e | 407 | .BR reiserfsck (8) |
dbaa5fda | 408 | .ad |
7208ef86 KZ |
409 | .SH AUTHORS |
410 | .nf | |
411 | Theodore Ts'o <tytso@mit.edu> | |
412 | Karel Zak <kzak@redhat.com> | |
12d69ae8 | 413 | .fi |
9c91fc03 BS |
414 | .SH AVAILABILITY |
415 | The fsck command is part of the util-linux package and is available from | |
d673b74e | 416 | .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/ |
9c91fc03 BS |
417 | Linux Kernel Archive |
418 | .UE . |