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