4.3BSD beta release manual page
[unix-history] / usr / src / sbin / fsck / fsck.8
CommitLineData
2d5205c6
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
96cc60b3 5.\" @(#)fsck.8 6.1 (Berkeley) %G%
2d5205c6 6.\"
96cc60b3 7.TH FSCK 8 ""
2d5205c6
KM
8.UC 4
9.de us
10\\$1\l'|0\(ul'
11..
12.SH NAME
13fsck \- file system consistency check and interactive repair
14.SH SYNOPSIS
15.B /etc/fsck
16.B \-p
17[
18filesystem ...
19]
20.br
21.B /etc/fsck
22[
0e46db50
KM
23.B \-b
24block#
25] [
2d5205c6
KM
26.B \-y
27] [
28.B \-n
29] [
2d5205c6
KM
30filesystem
31] ...
32.SH DESCRIPTION
33The first form of
34.I fsck
35preens a standard set of filesystems or the specified file systems.
36It is normally used in the script
37.B /etc/rc
38during automatic reboot.
39In this case
40.I fsck
41reads the table
42.B /etc/fstab
43to determine which file systems to check.
44It uses the information there to inspect groups of disks in parallel taking
45maximum advantage of i/o overlap to check the file systems
46as quickly as possible.
47Normally, the root file system will be checked on pass 1, other
48``root'' (``a'' partition) file systems on pass 2, other
49small file systems on separate passes (e.g. the ``d'' file systems
50on pass 3 and the ``e'' file systems on pass 4), and finally
51the large user file systems on the last pass, e.g. pass 5.
52A pass number of 0 in fstab causes a disk to not be checked; similarly
53partitions which are not shown as to be mounted ``rw'' or ``ro''
54are not checked.
55.PP
56The system takes care that only a restricted class of innocuous
57inconsistencies can happen unless hardware or software failures intervene.
58These are limited to the following:
59.IP
60Unreferenced inodes
61.ns
62.IP
63Link counts in inodes too large
64.ns
65.IP
66Missing blocks in the free list
67.ns
68.IP
69Blocks in the free list also in files
70.ns
71.IP
72Counts in the super-block wrong
73.PP
74These are the only inconsistencies which
75.I fsck
76with the
77.B \-p
78option will correct; if it encounters other inconsistencies, it exits
79with an abnormal return status and an automatic reboot will then fail.
80For each corrected inconsistency one or more lines will be printed
81identifying the file system on which the correction will take place,
82and the nature of the correction. After successfully correcting a file
83system,
84.I fsck
85will print the number of files on that file system and the number of
86used and free blocks.
87.PP
88Without the
89.B \-p
90option,
91.I fsck
92audits and interactively repairs inconsistent conditions for file systems.
93If the file system is inconsistent the operator is prompted for concurrence
94before each correction is attempted.
95It should be noted that a number of the corrective actions which are not
96fixable under the
97.B \-p
98option will result in some loss
99of data.
100The amount and severity of data lost may be determined from the diagnostic
101output.
102The default action for each consistency correction
103is to wait for the operator to respond \fByes\fP or \fBno\fP.
104If the operator does not have write permission
105.I fsck
106will default to a
107.BR "\-n " action.
108.PP
109.I Fsck
110has more consistency checks than
111its predecessors
112.IR "check, dcheck, fcheck, " "and" " icheck"
113combined.
114.PP
115The following flags are interpreted by
116.I fsck.
117.TP 6
0e46db50
KM
118.B \-b
119Use the block specified immediately after the flag as
120the super block for the file system. Block 32 is always
121an alternate super block.
122.TP 6
2d5205c6
KM
123.B \-y
124Assume a yes response to all questions asked by
125.I fsck;
126this should be used with great caution as this is a free license
127to continue after essentially unlimited trouble has been encountered.
128.TP 6
129.B \-n
130Assume a no response to all questions asked by
131.I fsck;
132do not open the file system for writing.
2d5205c6
KM
133.PP
134If no filesystems are given to
135.I fsck
136then a default list of file systems is read from
137the file
138.BR /etc/fstab .
139.PP
140.ne 10
141Inconsistencies checked are as follows:
142.TP 6
1431.
144Blocks claimed by more than one inode or the free list.
145.br
146.br
147.ns
148.TP 6
1492.
150Blocks claimed by an inode or the free list outside the range of the file system.
151.br
152.br
153.ns
154.TP 6
1553.
156Incorrect link counts.
157.br
158.br
159.ns
160.TP 6
1614.
162Size checks:
163.br
164.ns
165.IP "" 12
0e46db50 166Directory size not of proper format.
2d5205c6
KM
167.br
168.br
169.ns
170.TP 6
1715.
172Bad inode format.
173.br
174.br
175.ns
176.TP 6
1776.
178Blocks not accounted for anywhere.
179.br
180.br
181.ns
182.TP 6
1837.
184Directory checks:
185.br
186.br
187.ns
188.IP "" 12
189File pointing to unallocated inode.
190.br
191Inode number out of range.
192.br
193.br
194.ns
195.TP 6
1968.
197Super Block checks:
198.br
199.br
200.ns
201.IP "" 12
2d5205c6
KM
202.br
203More blocks for inodes than there are in the file system.
204.br
205.br
206.ns
207.TP 6
2089.
209Bad free block list format.
210.br
211.br
212.ns
213.TP 6
21410.
215Total free block and/or free inode count incorrect.
216.PP
217Orphaned files and directories (allocated but unreferenced) are,
218with the operator's concurrence, reconnected by
219placing them in the
220.B lost+found
221directory.
222The name assigned is the inode number. The only restriction
223is that the directory
224.B lost+found
225must preexist
226in the root of the filesystem being checked and
227must have empty slots in which entries can be made.
228This is accomplished by making
229.BR lost+found ,
230copying a number of files to the directory, and then removing them
231(before
232.I
233fsck
234is executed).
235.PP
236Checking the raw device is almost always faster.
237.SH FILES
238.br
239.ns
240.TP 21
241/etc/fstab
242contains default list of file systems to check.
243.SH DIAGNOSTICS
244The diagnostics produced by
245.I fsck
246are intended to be self-explanatory.
247.SH "SEE ALSO"
0e46db50
KM
248fstab(5),
249fs(5),
250newfs(8),
251mkfs(8),
252crash(8V),
253reboot(8)
2d5205c6
KM
254.SH BUGS
255Inode numbers for
256.BR . ""
257and
258.BR .. ""
259in each directory should be checked for validity.
260.PP
2d5205c6 261There should be some way to start a \fBfsck \-p\fR at pass \fIn\fR.