Fix sendmail_flags, long ago it was imported from /etc/netstart
[unix-history] / sbin / fsck / fsck.8
CommitLineData
15637ed4
RG
1.\" Copyright (c) 1980, 1989 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)fsck.8 6.9 (Berkeley) 4/20/91
33.\"
4c30d378
JH
34.\" $Header: /b/source/CVS/src/sbin/fsck/fsck.8,v 1.3 1993/03/23 00:27:48 cgd Exp $
35.\"
15637ed4
RG
36.TH FSCK 8 "April 20, 1991"
37.UC 4
38.de us
39\\$1\l'|0\(ul'
40..
41.SH NAME
42fsck \- file system consistency check and interactive repair
43.SH SYNOPSIS
44.B fsck
45.B \-p
46[
47.B \-m
48mode
49]
50.br
51.B fsck
52[
53.B \-b
54block#
55] [
56.B \-c
57] [
58.B \-y
59] [
60.B \-n
61] [
62.B \-m
63mode
64] [
65filesystem
66] ...
67.SH DESCRIPTION
68The first form of
69.I fsck
70preens a standard set of filesystems or the specified file systems.
71It is normally used in the script
72.B /etc/rc
73during automatic reboot.
74Here
75.I fsck
76reads the table
77.B /etc/fstab
78to determine which file systems to check.
79Only partitions in fstab that are mounted ``rw,'' ``rq'' or ``ro''
80and that have non-zero pass number are checked.
81Filesystems with pass number 1 (normally just the root filesystem)
82are checked one at a time.
83When pass 1 completes, all remaining filesystems are checked,
84running one process per disk drive.
85The disk drive containing each filesystem is inferred from the longest prefix
86of the device name that ends in a digit; the remaining characters are assumed
87to be the partition designator.
88.PP
89The system takes care that only a restricted class of innocuous
90inconsistencies can happen unless hardware or software failures intervene.
91These are limited to the following:
92.IP
93Unreferenced inodes
94.ns
95.IP
96Link counts in inodes too large
97.ns
98.IP
99Missing blocks in the free map
100.ns
101.IP
102Blocks in the free map also in files
103.ns
104.IP
105Counts in the super-block wrong
106.PP
107These are the only inconsistencies that
108.I fsck
109with the
110.B \-p
111option will correct; if it encounters other inconsistencies, it exits
112with an abnormal return status and an automatic reboot will then fail.
113For each corrected inconsistency one or more lines will be printed
114identifying the file system on which the correction will take place,
115and the nature of the correction. After successfully correcting a file
116system,
117.I fsck
118will print the number of files on that file system,
119the number of used and free blocks,
120and the percentage of fragmentation.
121.PP
122If sent a QUIT signal,
123.I fsck
124will finish the file system checks, then exit with an abnormal
125return status that causes an automatic reboot to fail.
126This is useful when to finish the file system checks during an automatic reboot,
127but do not want the machine to come up multiuser after the checks complete.
128.PP
129Without the
130.B \-p
131option,
132.I fsck
133audits and interactively repairs inconsistent conditions for file systems.
134If the file system is inconsistent the operator is prompted for concurrence
135before each correction is attempted.
136It should be noted that some of the corrective actions which are not
137correctable under the
138.B \-p
139option will result in some loss of data.
140The amount and severity of data lost may be determined from the diagnostic
141output.
142The default action for each consistency correction
143is to wait for the operator to respond \fByes\fP or \fBno\fP.
144If the operator does not have write permission on the file system
145.I fsck
146will default to a
147.BR "\-n " action.
148.PP
149.I Fsck
150has more consistency checks than
151its predecessors
152.IR "check, dcheck, fcheck, " "and" " icheck"
153combined.
154.PP
155The following flags are interpreted by
156.I fsck.
157.TP 6
158.B \-b
159Use the block specified immediately after the flag as
160the super block for the file system. Block 32 is usually
161an alternate super block.
162.TP 6
163.B \-l
164Limit the number of parallel checks to the number specified in the following
165argument.
166By default, the limit is the number of disks, running one process per disk.
167If a smaller limit is given, the disks are checked round-robin, one filesystem
168at a time.
169.TP 6
170.B \-m
171Use the mode specified in octal immediately after the flag as the
172permission bits to use when creating the lost+found directory
173rather than the default 1777.
174In particular, systems that do not wish to have lost files accessible
175by all users on the system should use a more restrictive
176set of permissions such as 700.
177.TP 6
178.B \-y
179Assume a yes response to all questions asked by
180.IR fsck ;
181this should be used with great caution as this is a free license
182to continue after essentially unlimited trouble has been encountered.
183.TP 6
184.B \-n
185Assume a no response to all questions asked by
186.I fsck
187except for ``CONTINUE?'', which is assumed to be affirmative;
188do not open the file system for writing.
189.TP 6
190.B \-c
191If the file system is in the old (static table) format,
192convert it to the new (dynamic table) format.
193If the file system is in the new format,
194convert it to the old format provided the old format
195can support the filesystem configuration.
196In interactive mode,
197.I fsck
198will list the direction the conversion is to be made
199and ask whether the conversion should be done.
200If a negative answer is given,
201no further operations are done on the filesystem.
202In preen mode,
203the direction of the conversion is listed and done if
204possible without user interaction.
205Conversion in preen mode is best used when all the file systems
206are being converted at once.
207The format of a file system can be determined from the
208first line of output from
209.IR dumpfs (8).
210.PP
211If no filesystems are given to
212.I fsck
213then a default list of file systems is read from
214the file
215.BR /etc/fstab .
216.PP
217.ne 10
218Inconsistencies checked are as follows:
219.TP 6
2201.
221Blocks claimed by more than one inode or the free map.
222.br
223.br
224.ns
225.TP 6
2262.
227Blocks claimed by an inode outside the range of the file system.
228.br
229.br
230.ns
231.TP 6
2323.
233Incorrect link counts.
234.br
235.br
236.ns
237.TP 6
2384.
239Size checks:
240.br
241.ns
242.IP "" 12
243Directory size not of proper format.
244.br
245Partially truncated file.
246.br
247.br
248.ns
249.TP 6
2505.
251Bad inode format.
252.br
253.br
254.ns
255.TP 6
2566.
257Blocks not accounted for anywhere.
258.br
259.br
260.ns
261.TP 6
2627.
263Directory checks:
264.br
265.br
266.ns
267.IP "" 12
268File pointing to unallocated inode.
269.br
270Inode number out of range.
271.br
272Dot or dot-dot not the first two entries of a directory
273or having the wrong inode number.
274.br
275.br
276.ns
277.TP 6
2788.
279Super Block checks:
280.br
281.br
282.ns
283.IP "" 12
284More blocks for inodes than there are in the file system.
285.br
286.br
287.ns
288.TP 6
2899.
290Bad free block map format.
291.br
292.br
293.ns
294.TP 6
29510.
296Total free block and/or free inode count incorrect.
297.PP
298Orphaned files and directories (allocated but unreferenced) are,
299with the operator's concurrence, reconnected by
300placing them in the
301.B lost+found
302directory.
303The name assigned is the inode number.
304If the
305.I lost+found
306directory does not exist, it is created.
307If there is insufficient space its size is increased.
308.PP
309Because of inconsistencies between the block device and the buffer cache,
310the raw device should always be used.
311.SH FILES
312.br
313.ns
314.TP 21
315/etc/fstab
316contains default list of file systems to check.
317.SH DIAGNOSTICS
318The diagnostics produced by
319.I fsck
320are fully enumerated and explained in Appendix A of
321``Fsck \- The UNIX File System Check Program'' (SMM:5).
322.SH "SEE ALSO"
323fstab(5),
324fs(5),
325fsdb(8),
326newfs(8),
327mkfs(8),
328reboot(8)