conversion and checking of dynamic and static cylinder group tables
[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.\"
c27eea89 5.\" @(#)fsck.8 6.2 (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.
c27eea89
KM
52Only partitions in fstab that are mounted ``rw'' or ``rq''
53and that have non-zero pass number are checked.
2d5205c6
KM
54.PP
55The system takes care that only a restricted class of innocuous
56inconsistencies can happen unless hardware or software failures intervene.
57These are limited to the following:
58.IP
59Unreferenced inodes
60.ns
61.IP
62Link counts in inodes too large
63.ns
64.IP
65Missing blocks in the free list
66.ns
67.IP
68Blocks in the free list also in files
69.ns
70.IP
71Counts in the super-block wrong
72.PP
c27eea89 73These are the only inconsistencies that
2d5205c6
KM
74.I fsck
75with the
76.B \-p
77option will correct; if it encounters other inconsistencies, it exits
78with an abnormal return status and an automatic reboot will then fail.
79For each corrected inconsistency one or more lines will be printed
80identifying the file system on which the correction will take place,
81and the nature of the correction. After successfully correcting a file
82system,
83.I fsck
c27eea89
KM
84will print the number of files on that file system,
85the number of used and free blocks,
86and the percentage of fragmentation.
87.PP
88If sent a QUIT signal,
89.I fsck
90will finish the file system checks, then exit with an abnormal
91return status that causes the automatic reboot to fail.
92This is useful when you wish to finish the file system checks,
93but do not want the machine to come up multiuser.
2d5205c6
KM
94.PP
95Without the
96.B \-p
97option,
98.I fsck
99audits and interactively repairs inconsistent conditions for file systems.
100If the file system is inconsistent the operator is prompted for concurrence
101before each correction is attempted.
c27eea89
KM
102It should be noted that some of the corrective actions which are not
103correctable under the
2d5205c6 104.B \-p
c27eea89 105option will result in some loss of data.
2d5205c6
KM
106The amount and severity of data lost may be determined from the diagnostic
107output.
108The default action for each consistency correction
109is to wait for the operator to respond \fByes\fP or \fBno\fP.
c27eea89 110If the operator does not have write permission on the file system
2d5205c6
KM
111.I fsck
112will default to a
113.BR "\-n " action.
114.PP
115.I Fsck
116has more consistency checks than
117its predecessors
118.IR "check, dcheck, fcheck, " "and" " icheck"
119combined.
120.PP
121The following flags are interpreted by
122.I fsck.
123.TP 6
0e46db50
KM
124.B \-b
125Use the block specified immediately after the flag as
126the super block for the file system. Block 32 is always
127an alternate super block.
128.TP 6
2d5205c6
KM
129.B \-y
130Assume a yes response to all questions asked by
131.I fsck;
132this should be used with great caution as this is a free license
133to continue after essentially unlimited trouble has been encountered.
134.TP 6
135.B \-n
136Assume a no response to all questions asked by
137.I fsck;
138do not open the file system for writing.
2d5205c6
KM
139.PP
140If no filesystems are given to
141.I fsck
142then a default list of file systems is read from
143the file
144.BR /etc/fstab .
145.PP
146.ne 10
147Inconsistencies checked are as follows:
148.TP 6
1491.
150Blocks claimed by more than one inode or the free list.
151.br
152.br
153.ns
154.TP 6
1552.
156Blocks claimed by an inode or the free list outside the range of the file system.
157.br
158.br
159.ns
160.TP 6
1613.
162Incorrect link counts.
163.br
164.br
165.ns
166.TP 6
1674.
168Size checks:
169.br
170.ns
171.IP "" 12
0e46db50 172Directory size not of proper format.
2d5205c6
KM
173.br
174.br
175.ns
176.TP 6
1775.
178Bad inode format.
179.br
180.br
181.ns
182.TP 6
1836.
184Blocks not accounted for anywhere.
185.br
186.br
187.ns
188.TP 6
1897.
190Directory checks:
191.br
192.br
193.ns
194.IP "" 12
195File pointing to unallocated inode.
196.br
197Inode number out of range.
198.br
199.br
200.ns
201.TP 6
2028.
203Super Block checks:
204.br
205.br
206.ns
207.IP "" 12
2d5205c6
KM
208.br
209More blocks for inodes than there are in the file system.
210.br
211.br
212.ns
213.TP 6
2149.
215Bad free block list format.
216.br
217.br
218.ns
219.TP 6
22010.
221Total free block and/or free inode count incorrect.
222.PP
223Orphaned files and directories (allocated but unreferenced) are,
224with the operator's concurrence, reconnected by
225placing them in the
226.B lost+found
227directory.
c27eea89
KM
228The name assigned is the inode number.
229If the
230.I lost+found
231directory does not exist, it is created.
232If there is insufficient space its size is increased.
2d5205c6
KM
233.PP
234Checking the raw device is almost always faster.
235.SH FILES
236.br
237.ns
238.TP 21
239/etc/fstab
240contains default list of file systems to check.
241.SH DIAGNOSTICS
242The diagnostics produced by
243.I fsck
c27eea89
KM
244are fully enumerated and explained in Appendix A of
245``Fsck \- The UNIX File System Check Program'' (SMM:5).
2d5205c6 246.SH "SEE ALSO"
0e46db50
KM
247fstab(5),
248fs(5),
249newfs(8),
250mkfs(8),
251crash(8V),
252reboot(8)
2d5205c6 253.SH BUGS
2d5205c6 254There should be some way to start a \fBfsck \-p\fR at pass \fIn\fR.