Deleted Added
full compact
1.\"
2.\" Copyright (c) 1980, 1989, 1991, 1993
3.\" The Regents of the University of California. All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
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.
20.\"
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
31.\" SUCH DAMAGE.
32.\"
33.\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
34.\" $FreeBSD: head/sbin/fsck_ffs/fsck_ffs.8 79754 2001-07-15 07:53:42Z dd $
34.\" $FreeBSD: head/sbin/fsck_ffs/fsck_ffs.8 87325 2001-12-04 02:19:58Z obrien $
35.\"
36.Dd April 24, 2001
37.Dt FSCK_FFS 8
38.Os
39.Sh NAME
40.Nm fsck_ffs ,
41.Nm fsck_ufs
42.Nd filesystem consistency check and interactive repair
43.Sh SYNOPSIS
44.Nm
45.Op Fl BFpfny
46.Op Fl b Ar block#
47.Op Fl c Ar level
48.Op Fl m Ar mode
49.Ar filesystem
50.Ar ...
51.Sh DESCRIPTION
52The specified disk partitions and/or filesystems are checked.
53In "preen" mode the clean flag of each filesystem's superblock is examined
54and only those filesystems that
55are not marked clean are checked.
56Filesystems are marked clean when they are unmounted,
57when they have been mounted read-only, or when
58.Nm
59runs on them successfully.
60If the
61.Fl f
62option is specified, the filesystems
63will be checked regardless of the state of their clean flag.
64.Pp
65The kernel takes care that only a restricted class of innocuous filesystem
66inconsistencies can happen unless hardware or software failures intervene.
67These are limited to the following:
68.Pp
69.Bl -item -compact -offset indent
70.It
71Unreferenced inodes
72.It
73Link counts in inodes too large
74.It
75Missing blocks in the free map
76.It
77Blocks in the free map also in files
78.It
79Counts in the super-block wrong
80.El
81.Pp
82These are the only inconsistencies that
83.Nm
84with the
85.Fl p
86option will correct; if it encounters other inconsistencies, it exits
87with an abnormal return status and an automatic reboot will then fail.
88For each corrected inconsistency one or more lines will be printed
89identifying the filesystem on which the correction will take place,
90and the nature of the correction. After successfully correcting a filesystem,
91.Nm
92will print the number of files on that filesystem,
93the number of used and free blocks,
94and the percentage of fragmentation.
95.Pp
96If sent a
97.Dv QUIT
98signal,
99.Nm
100will finish the filesystem checks, then exit with an abnormal
101return status that causes an automatic reboot to fail.
102This is useful when you want to finish the filesystem checks during an
103automatic reboot,
104but do not want the machine to come up multiuser after the checks complete.
105.Pp
106If
107.Nm
108receives a
109.Dv SIGINFO
110(see the
111.Dq status
112argument for
113.Xr stty 1 )
114signal, a line will be written to the standard output indicating
115the name of the device currently being checked, the current phase
116number and phase-specific progress information.
117.Pp
118Without the
119.Fl p
120option,
121.Nm
122audits and interactively repairs inconsistent conditions for filesystems.
123If the filesystem is inconsistent the operator is prompted for concurrence
124before each correction is attempted.
125It should be noted that some of the corrective actions which are not
126correctable under the
127.Fl p
128option will result in some loss of data.
129The amount and severity of data lost may be determined from the diagnostic
130output.
131The default action for each consistency correction
132is to wait for the operator to respond
133.Li yes
134or
135.Li no .
136If the operator does not have write permission on the filesystem
137.Nm
138will default to a
139.Fl n
140action.
141.Pp
142The following flags are interpreted by
143.Nm :
144.Bl -tag -width indent
145.It Fl F
146Determine whether the filesystem needs to be cleaned immediately
147in foreground, or if its cleaning can be deferred to background.
148To be eligible for background cleaning it must have been running
149with soft updates, not have been marked as needing a foreground check,
150and be mounted and writable when the background check is to be done.
151If these conditions are met, then
152.Nm
153exits with a zero exit status.
154Otherwise it exits with a non-zero exit status.
155If the filesystem is clean,
156it will exit with a non-zero exit status so that the clean status
157of the filesystem can be verified and reported during the foreground
158checks.
159Note that when invoked with the
160.Fl F
161flag, no cleanups are done.
162The only thing that
163.Nm
164does is to determine whether a foreground or background
165check is needed and exit with an appropriate status code.
166.It Fl B
167A check is done on the specified and possibly active filesystem.
168The set of corrections that can be done is limited to those done
169when running in preen mode (see the
170.Fl p
171flag).
172If unexpected errors are found,
173the filesystem is marked as needing a foreground check and
174.Nm
175exits without attempting any further cleaning.
176.It Fl b
177Use the block specified immediately after the flag as
178the super block for the filesystem. Block 32 is usually
179an alternate super block.
180.It Fl c
181Convert the filesystem to the specified level.
182Note that the level of a filesystem can only be raised.
183There are currently four levels defined:
184.Bl -tag -width indent
185.It 0
186The filesystem is in the old (static table) format.
187.It 1
188The filesystem is in the new (dynamic table) format.
189.It 2
190The filesystem supports 32-bit uid's and gid's,
191short symbolic links are stored in the inode,
192and directories have an added field showing the file type.
193.It 3
194If maxcontig is greater than one,
195build the free segment maps to aid in finding contiguous sets of blocks.
196If maxcontig is equal to one, delete any existing segment maps.
197.El
198.Pp
199In interactive mode,
200.Nm
201will list the conversion to be made
202and ask whether the conversion should be done.
203If a negative answer is given,
204no further operations are done on the filesystem.
205In preen mode,
206the conversion is listed and done if
207possible without user interaction.
208Conversion in preen mode is best used when all the filesystems
209are being converted at once.
210The format of a filesystem can be determined from the
211first line of output from
212.Xr dumpfs 8 .
213.It Fl f
214Force
215.Nm
216to check
217.Sq clean
218filesystems when preening.
219.It Fl m
220Use the mode specified in octal immediately after the flag as the
221permission bits to use when creating the
222.Pa lost+found
223directory rather than the default 1777.
224In particular, systems that do not wish to have lost files accessible
225by all users on the system should use a more restrictive
226set of permissions such as 700.
227.It Fl n
228Assume a no response to all questions asked by
229.Nm
230except for
231.Ql CONTINUE? ,
232which is assumed to be affirmative;
233do not open the filesystem for writing.
234.It Fl p
235Preen filesystems (see above).
236.It Fl y
237Assume a yes response to all questions asked by
238.Nm ;
239this should be used with great caution as this is a free license
240to continue after essentially unlimited trouble has been encountered.
241.El
242.Pp
243Inconsistencies checked are as follows:
244.Pp
245.Bl -enum -compact
246.It
247Blocks claimed by more than one inode or the free map.
248.It
249Blocks claimed by an inode outside the range of the filesystem.
250.It
251Incorrect link counts.
252.It
253Size checks:
254.Bl -item -offset indent -compact
255.It
256Directory size not a multiple of DIRBLKSIZ.
257.It
258Partially truncated file.
259.El
260.It
261Bad inode format.
262.It
263Blocks not accounted for anywhere.
264.It
265Directory checks:
266.Bl -item -offset indent -compact
267.It
268File pointing to unallocated inode.
269.It
270Inode number out of range.
271.It
272Directories with unallocated blocks (holes).
273.It
274Dot or dot-dot not the first two entries of a directory
275or having the wrong inode number.
276.El
277.It
278Super Block checks:
279.Bl -item -offset indent -compact
280.It
281More blocks for inodes than there are in the filesystem.
282.It
283Bad free block map format.
284.It
285Total free block and/or free inode count incorrect.
286.El
287.El
288.Pp
289Orphaned files and directories (allocated but unreferenced) are,
290with the operator's concurrence, reconnected by
291placing them in the
292.Pa lost+found
293directory.
294The name assigned is the inode number.
295If the
296.Pa lost+found
297directory does not exist, it is created.
298If there is insufficient space its size is increased.
299.Sh RETURN VALUES
300.Nm
301returns the value 0 if successful;
302otherwise the following values are returned to indicate the error.
303.Sh FILES
304.Bl -tag -width /etc/fstab -compact
305.It Pa /etc/fstab
306contains default list of filesystems to check.
307.El
308.Sh DIAGNOSTICS
309The diagnostics produced by
310.Nm
311are fully enumerated and explained in Appendix A of
312.Rs
313.%T "Fsck \- The UNIX File System Check Program"
314.Re
315.Sh SEE ALSO
316.Xr fs 5 ,
317.Xr fstab 5 ,
318.Xr fsck 8 ,
319.Xr fsdb 8 ,
320.Xr newfs 8 ,
321.Xr reboot 8