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 .\" 4. Neither the name of the University nor the names of its contributors
14 .\" may be used to endorse or promote products derived from this software
15 .\" without specific prior written permission.
17 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
38 .Nd file system consistency check and interactive repair
48 The specified disk partitions and/or file systems are checked.
49 In "preen" or "check clean" mode the clean flag of each file system's
50 superblock is examined and only those file systems that are not marked clean
52 File systems are marked clean when they are unmounted,
53 when they have been mounted read-only, or when
55 runs on them successfully.
58 option is specified, the file systems
59 will be checked regardless of the state of their clean flag.
61 The kernel takes care that only a restricted class of innocuous file system
62 inconsistencies can happen unless hardware or software failures intervene.
63 These are limited to the following:
65 .Bl -item -compact -offset indent
69 Link counts in inodes too large
71 Missing blocks in the free map
73 Blocks in the free map also in files
75 Counts in the super-block wrong
78 These are the only inconsistencies that
82 option will correct; if it encounters other inconsistencies, it exits
83 with an abnormal return status and an automatic reboot will then fail.
84 For each corrected inconsistency one or more lines will be printed
85 identifying the file system on which the correction will take place,
86 and the nature of the correction.
87 After successfully correcting a file system,
89 will print the number of files on that file system,
90 the number of used and free blocks,
91 and the percentage of fragmentation.
97 will finish the file system checks, then exit with an abnormal
98 return status that causes an automatic reboot to fail.
99 This is useful when you want to finish the file system checks during an
101 but do not want the machine to come up multiuser after the checks complete.
111 signal, a line will be written to the standard output indicating
112 the name of the device currently being checked, the current phase
113 number and phase-specific progress information.
119 audits and interactively repairs inconsistent conditions for file systems.
120 If the file system is inconsistent the operator is prompted for concurrence
121 before each correction is attempted.
122 It should be noted that some of the corrective actions which are not
123 correctable under the
125 option will result in some loss of data.
126 The amount and severity of data lost may be determined from the diagnostic
128 The default action for each consistency correction
129 is to wait for the operator to respond
133 If the operator does not have write permission on the file system
139 The following flags are interpreted by
141 .Bl -tag -width indent
143 Determine whether the file system needs to be cleaned immediately
144 in foreground, or if its cleaning can be deferred to background.
145 To be eligible for background cleaning it must have been running
146 with soft updates, not have been marked as needing a foreground check,
147 and be mounted and writable when the background check is to be done.
148 If these conditions are met, then
150 exits with a zero exit status.
151 Otherwise it exits with a non-zero exit status.
152 If the file system is clean,
153 it will exit with a non-zero exit status so that the clean status
154 of the file system can be verified and reported during the foreground
156 Note that when invoked with the
158 flag, no cleanups are done.
161 does is to determine whether a foreground or background
162 check is needed and exit with an appropriate status code.
164 A check is done on the specified and possibly active file system.
165 The set of corrections that can be done is limited to those done
166 when running in preen mode (see the
169 If unexpected errors are found,
170 the file system is marked as needing a foreground check and
172 exits without attempting any further cleaning.
174 Use the block specified immediately after the flag as
175 the super block for the file system.
176 An alternate super block is usually located at block 32 for UFS1,
177 and block 160 for UFS2.
179 Check if file system was dismounted cleanly.
180 If so, skip file system checks (like "preen").
181 However, if the file system was not cleanly dismounted, do full checks,
187 Convert the file system to the specified level.
188 Note that the level of a file system can only be raised.
189 There are currently four levels defined:
190 .Bl -tag -width indent
192 The file system is in the old (static table) format.
194 The file system is in the new (dynamic table) format.
196 The file system supports 32-bit uid's and gid's,
197 short symbolic links are stored in the inode,
198 and directories have an added field showing the file type.
200 If maxcontig is greater than one,
201 build the free segment maps to aid in finding contiguous sets of blocks.
202 If maxcontig is equal to one, delete any existing segment maps.
207 will list the conversion to be made
208 and ask whether the conversion should be done.
209 If a negative answer is given,
210 no further operations are done on the file system.
212 the conversion is listed and done if
213 possible without user interaction.
214 Conversion in preen mode is best used when all the file systems
215 are being converted at once.
216 The format of a file system can be determined from the
217 first line of output from
220 This option implies the
228 file systems when preening.
230 Use the mode specified in octal immediately after the flag as the
231 permission bits to use when creating the
233 directory rather than the default 1777.
234 In particular, systems that do not wish to have lost files accessible
235 by all users on the system should use a more restrictive
236 set of permissions such as 700.
238 Assume a no response to all questions asked by
242 which is assumed to be affirmative;
243 do not open the file system for writing.
245 Preen file systems (see above).
247 Free up excess unused inodes.
248 Decreasing the number of preallocated inodes reduces the
249 running time of future runs of
251 and frees up space that can allocated to files.
254 option is ignored when running in preen mode.
256 Assume a yes response to all questions asked by
258 this should be used with great caution as this is a free license
259 to continue after essentially unlimited trouble has been encountered.
262 Inconsistencies checked are as follows:
266 Blocks claimed by more than one inode or the free map.
268 Blocks claimed by an inode outside the range of the file system.
270 Incorrect link counts.
273 .Bl -item -offset indent -compact
275 Directory size not a multiple of DIRBLKSIZ.
277 Partially truncated file.
282 Blocks not accounted for anywhere.
285 .Bl -item -offset indent -compact
287 File pointing to unallocated inode.
289 Inode number out of range.
291 Directories with unallocated blocks (holes).
293 Dot or dot-dot not the first two entries of a directory
294 or having the wrong inode number.
298 .Bl -item -offset indent -compact
300 More blocks for inodes than there are in the file system.
302 Bad free block map format.
304 Total free block and/or free inode count incorrect.
308 Orphaned files and directories (allocated but unreferenced) are,
309 with the operator's concurrence, reconnected by
313 The name assigned is the inode number.
316 directory does not exist, it is created.
317 If there is insufficient space its size is increased.
321 checks for many more problems that may occur after an
322 unrecoverable disk write error.
323 Thus, it is recommended that you perform foreground
325 on your systems periodically and whenever you encounter
326 unrecoverable disk write errors or file-system\-related panics.
328 .Bl -tag -width /etc/fstab -compact
330 contains default list of file systems to check.
339 exits 7 if the file system is clean.
341 The diagnostics produced by
343 are fully enumerated and explained in Appendix A of
345 .%T "Fsck \- The UNIX File System Check Program"