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