date and time created 92/07/12 13:02:36 by cael
[unix-history] / usr / src / sbin / fsck / fsck.8
CommitLineData
922de9ec 1.\" Copyright (c) 1980, 1989 Regents of the University of California.
6aace6eb 2.\" All rights reserved.
2d5205c6 3.\"
6aace6eb
CL
4.\" %sccs.include.redist.man%
5.\"
6.\" @(#)fsck.8 6.9 (Berkeley) %G%
2d5205c6 7.\"
96cc60b3 8.TH FSCK 8 ""
2d5205c6
KM
9.UC 4
10.de us
11\\$1\l'|0\(ul'
12..
13.SH NAME
14fsck \- file system consistency check and interactive repair
15.SH SYNOPSIS
922de9ec 16.B fsck
2d5205c6
KM
17.B \-p
18[
c689da7b
KM
19.B \-m
20mode
2d5205c6
KM
21]
22.br
922de9ec 23.B fsck
2d5205c6 24[
0e46db50
KM
25.B \-b
26block#
27] [
6209594a
KM
28.B \-c
29] [
2d5205c6
KM
30.B \-y
31] [
32.B \-n
33] [
c689da7b
KM
34.B \-m
35mode
36] [
2d5205c6
KM
37filesystem
38] ...
39.SH DESCRIPTION
40The first form of
41.I fsck
42preens a standard set of filesystems or the specified file systems.
43It is normally used in the script
44.B /etc/rc
45during automatic reboot.
cd156a5e 46Here
2d5205c6
KM
47.I fsck
48reads the table
49.B /etc/fstab
50to determine which file systems to check.
922de9ec 51Only partitions in fstab that are mounted ``rw,'' ``rq'' or ``ro''
c27eea89 52and that have non-zero pass number are checked.
5eeaeb24
MK
53Filesystems with pass number 1 (normally just the root filesystem)
54are checked one at a time.
55When pass 1 completes, all remaining filesystems are checked,
56running one process per disk drive.
57The disk drive containing each filesystem is inferred from the longest prefix
58of the device name that ends in a digit; the remaining characters are assumed
59to be the partition designator.
2d5205c6
KM
60.PP
61The system takes care that only a restricted class of innocuous
62inconsistencies can happen unless hardware or software failures intervene.
63These are limited to the following:
64.IP
65Unreferenced inodes
66.ns
67.IP
68Link counts in inodes too large
69.ns
70.IP
6209594a 71Missing blocks in the free map
2d5205c6
KM
72.ns
73.IP
6209594a 74Blocks in the free map also in files
2d5205c6
KM
75.ns
76.IP
77Counts in the super-block wrong
78.PP
c27eea89 79These are the only inconsistencies that
2d5205c6
KM
80.I fsck
81with the
82.B \-p
83option will correct; if it encounters other inconsistencies, it exits
84with an abnormal return status and an automatic reboot will then fail.
85For each corrected inconsistency one or more lines will be printed
86identifying the file system on which the correction will take place,
87and the nature of the correction. After successfully correcting a file
88system,
89.I fsck
c27eea89
KM
90will print the number of files on that file system,
91the number of used and free blocks,
92and the percentage of fragmentation.
93.PP
94If sent a QUIT signal,
95.I fsck
96will finish the file system checks, then exit with an abnormal
5eeaeb24
MK
97return status that causes an automatic reboot to fail.
98This is useful when to finish the file system checks during an automatic reboot,
99but do not want the machine to come up multiuser after the checks complete.
2d5205c6
KM
100.PP
101Without the
102.B \-p
103option,
104.I fsck
105audits and interactively repairs inconsistent conditions for file systems.
106If the file system is inconsistent the operator is prompted for concurrence
107before each correction is attempted.
c27eea89
KM
108It should be noted that some of the corrective actions which are not
109correctable under the
2d5205c6 110.B \-p
c27eea89 111option will result in some loss of data.
2d5205c6
KM
112The amount and severity of data lost may be determined from the diagnostic
113output.
114The default action for each consistency correction
115is to wait for the operator to respond \fByes\fP or \fBno\fP.
c27eea89 116If the operator does not have write permission on the file system
2d5205c6
KM
117.I fsck
118will default to a
119.BR "\-n " action.
120.PP
121.I Fsck
122has more consistency checks than
123its predecessors
124.IR "check, dcheck, fcheck, " "and" " icheck"
125combined.
126.PP
127The following flags are interpreted by
128.I fsck.
129.TP 6
0e46db50
KM
130.B \-b
131Use the block specified immediately after the flag as
6209594a 132the super block for the file system. Block 32 is usually
0e46db50
KM
133an alternate super block.
134.TP 6
5eeaeb24
MK
135.B \-l
136Limit the number of parallel checks to the number specified in the following
137argument.
138By default, the limit is the number of disks, running one process per disk.
139If a smaller limit is given, the disks are checked round-robin, one filesystem
140at a time.
141.TP 6
c689da7b
KM
142.B \-m
143Use the mode specified in octal immediately after the flag as the
144permission bits to use when creating the lost+found directory
145rather than the default 1777.
146In particular, systems that do not wish to have lost files accessible
147by all users on the system should use a more restrictive
148set of permissions such as 700.
149.TP 6
2d5205c6
KM
150.B \-y
151Assume a yes response to all questions asked by
922de9ec 152.IR fsck ;
2d5205c6
KM
153this should be used with great caution as this is a free license
154to continue after essentially unlimited trouble has been encountered.
155.TP 6
156.B \-n
157Assume a no response to all questions asked by
922de9ec
MK
158.I fsck
159except for ``CONTINUE?'', which is assumed to be affirmative;
2d5205c6 160do not open the file system for writing.
6209594a
KM
161.TP 6
162.B \-c
163If the file system is in the old (static table) format,
164convert it to the new (dynamic table) format.
165If the file system is in the new format,
166convert it to the old format provided the old format
167can support the filesystem configuration.
168In interactive mode,
169.I fsck
170will list the direction the conversion is to be made
171and ask whether the conversion should be done.
172If a negative answer is given,
173no further operations are done on the filesystem.
174In preen mode,
175the direction of the conversion is listed and done if
176possible without user interaction.
177Conversion in preen mode is best used when all the file systems
178are being converted at once.
179The format of a file system can be determined from the
180first line of output from
181.IR dumpfs (8).
2d5205c6
KM
182.PP
183If no filesystems are given to
184.I fsck
185then a default list of file systems is read from
186the file
187.BR /etc/fstab .
188.PP
189.ne 10
190Inconsistencies checked are as follows:
191.TP 6
1921.
6209594a 193Blocks claimed by more than one inode or the free map.
2d5205c6
KM
194.br
195.br
196.ns
197.TP 6
1982.
6209594a 199Blocks claimed by an inode outside the range of the file system.
2d5205c6
KM
200.br
201.br
202.ns
203.TP 6
2043.
205Incorrect link counts.
206.br
207.br
208.ns
209.TP 6
2104.
211Size checks:
212.br
213.ns
214.IP "" 12
0e46db50 215Directory size not of proper format.
2d5205c6 216.br
6209594a
KM
217Partially truncated file.
218.br
2d5205c6
KM
219.br
220.ns
221.TP 6
2225.
223Bad inode format.
224.br
225.br
226.ns
227.TP 6
2286.
229Blocks not accounted for anywhere.
230.br
231.br
232.ns
233.TP 6
2347.
235Directory checks:
236.br
237.br
238.ns
239.IP "" 12
240File pointing to unallocated inode.
241.br
242Inode number out of range.
243.br
cd156a5e
KM
244Dot or dot-dot not the first two entries of a directory
245or having the wrong inode number.
246.br
2d5205c6
KM
247.br
248.ns
249.TP 6
2508.
251Super Block checks:
252.br
253.br
254.ns
255.IP "" 12
2d5205c6
KM
256More blocks for inodes than there are in the file system.
257.br
258.br
259.ns
260.TP 6
2619.
6209594a 262Bad free block map format.
2d5205c6
KM
263.br
264.br
265.ns
266.TP 6
26710.
268Total free block and/or free inode count incorrect.
269.PP
270Orphaned files and directories (allocated but unreferenced) are,
271with the operator's concurrence, reconnected by
272placing them in the
273.B lost+found
274directory.
c27eea89
KM
275The name assigned is the inode number.
276If the
277.I lost+found
278directory does not exist, it is created.
279If there is insufficient space its size is increased.
2d5205c6 280.PP
cd156a5e
KM
281Because of inconsistencies between the block device and the buffer cache,
282the raw device should always be used.
2d5205c6
KM
283.SH FILES
284.br
285.ns
286.TP 21
287/etc/fstab
288contains default list of file systems to check.
289.SH DIAGNOSTICS
290The diagnostics produced by
291.I fsck
c27eea89
KM
292are fully enumerated and explained in Appendix A of
293``Fsck \- The UNIX File System Check Program'' (SMM:5).
2d5205c6 294.SH "SEE ALSO"
0e46db50
KM
295fstab(5),
296fs(5),
8ad6dcc6 297fsdb(8),
0e46db50
KM
298newfs(8),
299mkfs(8),
0e46db50 300reboot(8)