2 .\" Copyright (c) 1980, 1989, 1991, 1993
3 .\" The Regents of the University of California. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\" must display the following acknowledgment:
15 .\" This product includes software developed by the University of
16 .\" California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
42 .Nd filesystem consistency check and interactive repair
52 The specified disk partitions and/or filesystems are checked.
53 In "preen" mode the clean flag of each filesystem's superblock is examined
54 and only those filesystems that
55 are not marked clean are checked.
56 Filesystems are marked clean when they are unmounted,
57 when they have been mounted read-only, or when
59 runs on them successfully.
62 option is specified, the filesystems
63 will be checked regardless of the state of their clean flag.
65 The kernel takes care that only a restricted class of innocuous filesystem
66 inconsistencies can happen unless hardware or software failures intervene.
67 These are limited to the following:
69 .Bl -item -compact -offset indent
73 Link counts in inodes too large
75 Missing blocks in the free map
77 Blocks in the free map also in files
79 Counts in the super-block wrong
82 These are the only inconsistencies that
86 option will correct; if it encounters other inconsistencies, it exits
87 with an abnormal return status and an automatic reboot will then fail.
88 For each corrected inconsistency one or more lines will be printed
89 identifying the filesystem on which the correction will take place,
90 and the nature of the correction. After successfully correcting a filesystem,
92 will print the number of files on that filesystem,
93 the number of used and free blocks,
94 and the percentage of fragmentation.
100 will finish the filesystem checks, then exit with an abnormal
101 return status that causes an automatic reboot to fail.
102 This is useful when you want to finish the filesystem checks during an
104 but do not want the machine to come up multiuser after the checks complete.
114 signal, a line will be written to the standard output indicating
115 the name of the device currently being checked, the current phase
116 number and phase-specific progress information.
122 audits and interactively repairs inconsistent conditions for filesystems.
123 If the filesystem is inconsistent the operator is prompted for concurrence
124 before each correction is attempted.
125 It should be noted that some of the corrective actions which are not
126 correctable under the
128 option will result in some loss of data.
129 The amount and severity of data lost may be determined from the diagnostic
131 The default action for each consistency correction
132 is to wait for the operator to respond
136 If the operator does not have write permission on the filesystem
142 The following flags are interpreted by
144 .Bl -tag -width indent
146 Determine whether the filesystem needs to be cleaned immediately
147 in foreground, or if its cleaning can be deferred to background.
148 To be eligible for background cleaning it must have been running
149 with soft updates, not have been marked as needing a foreground check,
150 and be mounted and writable when the background check is to be done.
151 If these conditions are met, then
153 exits with a zero exit status.
154 Otherwise it exits with a non-zero exit status.
155 If the filesystem is clean,
156 it will exit with a non-zero exit status so that the clean status
157 of the filesystem can be verified and reported during the foreground
159 Note that when invoked with the
161 flag, no cleanups are done.
164 does is to determine whether a foreground or background
165 check is needed and exit with an appropriate status code.
167 A check is done on the specified and possibly active filesystem.
168 The set of corrections that can be done is limited to those done
169 when running in preen mode (see the
172 If unexpected errors are found,
173 the filesystem is marked as needing a foreground check and
175 exits without attempting any further cleaning.
177 Use the block specified immediately after the flag as
178 the super block for the filesystem. Block 32 is usually
179 an alternate super block.
181 Convert the filesystem to the specified level.
182 Note that the level of a filesystem can only be raised.
183 There are currently four levels defined:
184 .Bl -tag -width indent
186 The filesystem is in the old (static table) format.
188 The filesystem is in the new (dynamic table) format.
190 The filesystem supports 32-bit uid's and gid's,
191 short symbolic links are stored in the inode,
192 and directories have an added field showing the file type.
194 If maxcontig is greater than one,
195 build the free segment maps to aid in finding contiguous sets of blocks.
196 If maxcontig is equal to one, delete any existing segment maps.
201 will list the conversion to be made
202 and ask whether the conversion should be done.
203 If a negative answer is given,
204 no further operations are done on the filesystem.
206 the conversion is listed and done if
207 possible without user interaction.
208 Conversion in preen mode is best used when all the filesystems
209 are being converted at once.
210 The format of a filesystem can be determined from the
211 first line of output from
218 filesystems when preening.
220 Use the mode specified in octal immediately after the flag as the
221 permission bits to use when creating the
223 directory rather than the default 1777.
224 In particular, systems that do not wish to have lost files accessible
225 by all users on the system should use a more restrictive
226 set of permissions such as 700.
228 Assume a no response to all questions asked by
232 which is assumed to be affirmative;
233 do not open the filesystem for writing.
235 Preen filesystems (see above).
237 Assume a yes response to all questions asked by
239 this should be used with great caution as this is a free license
240 to continue after essentially unlimited trouble has been encountered.
243 Inconsistencies checked are as follows:
247 Blocks claimed by more than one inode or the free map.
249 Blocks claimed by an inode outside the range of the filesystem.
251 Incorrect link counts.
254 .Bl -item -offset indent -compact
256 Directory size not a multiple of DIRBLKSIZ.
258 Partially truncated file.
263 Blocks not accounted for anywhere.
266 .Bl -item -offset indent -compact
268 File pointing to unallocated inode.
270 Inode number out of range.
272 Directories with unallocated blocks (holes).
274 Dot or dot-dot not the first two entries of a directory
275 or having the wrong inode number.
279 .Bl -item -offset indent -compact
281 More blocks for inodes than there are in the filesystem.
283 Bad free block map format.
285 Total free block and/or free inode count incorrect.
289 Orphaned files and directories (allocated but unreferenced) are,
290 with the operator's concurrence, reconnected by
294 The name assigned is the inode number.
297 directory does not exist, it is created.
298 If there is insufficient space its size is increased.
300 .Bl -tag -width /etc/fstab -compact
302 contains default list of filesystems to check.
307 The diagnostics produced by
309 are fully enumerated and explained in Appendix A of
311 .%T "Fsck \- The UNIX File System Check Program"