1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH FSCK 1M "May 7, 2008"
8 .SH NAME
9 fsck \- check and repair file systems
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fBfsck\fR [\fB-F\fR \fIFSType\fR] [\fB-m\fR] [\fB-V\fR] [\fB-v\fR] [\fIspecial\fR]...
14 .fi
15
16 .LP
17 .nf
18 \fBfsck\fR [\fB-F\fR \fIFSType\fR] [\fB-n\fR | N | y | Y] [\fB-V\fR] [\fB-v\fR]
19 [\fB-o\fR \fIFSType-specific-options\fR] [\fIspecial\fR]...
20 .fi
21
22 .SH DESCRIPTION
23 .sp
24 .LP
25 \fBfsck\fR audits and interactively repairs inconsistent file system
26 conditions. If the file system is inconsistent the default action for each
27 correction is to wait for the user to respond \fByes\fR or \fBno\fR. If the
28 user does not have write permission \fBfsck\fR defaults to a \fBno\fR action.
29 Some corrective actions will result in loss of data. The amount and severity of
30 data loss can be determined from the diagnostic output.
31 .sp
32 .LP
33 \fIFSType-specific-options\fR are options specified in a comma-separated (with
34 no intervening spaces) list of options or keyword-attribute pairs for
35 interpretation by the \fIFSType-\fRspecific module of the command.
36 .sp
37 .LP
38 \fIspecial\fR represents the character special device on which the file system
39 resides, for example, \fB/dev/rdsk/c1t0d0s7\fR. Note: the character special
40 device, not the block special device, should be used. \fBfsck\fR will not work
41 if the block device is mounted.
42 .sp
43 .LP
44 If no \fIspecial\fR device is specified \fBfsck\fR checks the file systems
45 listed in \fB/etc/vfstab\fR. Those entries in \fB/etc/vfstab\fR which have a
46 character special device entry in the \fBfsckdev\fR field and have a non-zero
47 numeric entry in the \fBfsckpass\fR field will be checked. Specifying \fB-F\fR
48 \fIFSType\fR limits the file systems to be checked to those of the type
49 indicated.
50 .sp
51 .LP
52 If \fIspecial\fR is specified, but \fB-F\fR is not, the file system type will
53 be determined by looking for a matching entry in \fB/etc/vfstab\fR. If no entry
54 is found, the default local file system type specified in \fB/etc/default/fs\fR
55 will be used.
56 .sp
57 .LP
58 If a file system type supports parallel checking, for example, \fBufs,\fR some
59 file systems eligible for checking may be checked in parallel. Consult the file
60 system-specific man page (for example, \fBfsck_ufs\fR(1M)) for more
61 information.
62 .SH OPTIONS
63 .sp
64 .LP
65 The following generic options are supported:
66 .sp
67 .ne 2
68 .na
69 \fB\fB-F\fR \fIFSType\fR\fR
70 .ad
71 .sp .6
72 .RS 4n
73 Specify the file system type on which to operate.
74 .RE
75
76 .sp
77 .ne 2
78 .na
79 \fB\fB-m\fR\fR
80 .ad
81 .sp .6
82 .RS 4n
83 Check but do not repair. This option checks that the file system is suitable
84 for mounting, returning the appropriate exit status. If the file system is
85 ready for mounting, \fBfsck\fR displays a message such as:
86 .sp
87 .in +2
88 .nf
89 ufs fsck: sanity check: /dev/rdsk/c0t3d0s1 okay
90 .fi
91 .in -2
92 .sp
93
94 .RE
95
96 .sp
97 .ne 2
98 .na
99 \fB\fB-n\fR | \fB-N\fR\fR
100 .ad
101 .sp .6
102 .RS 4n
103 Assume a \fBno\fR response to all questions asked by \fBfsck\fR; do not open
104 the file system for writing.
105 .RE
106
107 .sp
108 .ne 2
109 .na
110 \fB\fB-V\fR\fR
111 .ad
112 .sp .6
113 .RS 4n
114 Echo the expanded command line but do not execute the command. This option may
115 be used to verify and to validate the command line.
116 .RE
117
118 .sp
119 .ne 2
120 .na
121 \fB\fB-v\fR\fR
122 .ad
123 .sp .6
124 .RS 4n
125 Enables verbose output. Might not be supported by all filesystem-specific
126 \fBfsck\fR implementations.
127 .RE
128
129 .sp
130 .ne 2
131 .na
132 \fB\fB-y\fR | \fBY\fR\fR
133 .ad
134 .sp .6
135 .RS 4n
136 Assume a \fByes\fR response to all questions asked by \fBfsck\fR.
137 .RE
138
139 .sp
140 .ne 2
141 .na
142 \fB\fB-o\fR \fIspecific-options\fR\fR
143 .ad
144 .sp .6
145 .RS 4n
146 These \fIspecific-options\fR can be any combination of the following separated
147 by commas (with no intervening spaces).
148 .sp
149 .ne 2
150 .na
151 \fB\fBb=\fR\fIn\fR\fR
152 .ad
153 .sp .6
154 .RS 4n
155 Use block \fIn\fR as the super block for the file system. Block 32 is always
156 one of the alternate super blocks. Determine the location of other super blocks
157 by running \fBnewfs\fR(1M) with the \fB-Nv\fR options specified.
158 .RE
159
160 .sp
161 .ne 2
162 .na
163 \fB\fBc\fR\fR
164 .ad
165 .sp .6
166 .RS 4n
167 If the file system is in the old (static table) format, convert it to the new
168 (dynamic table) format. If the file system is in the new format, convert it to
169 the old format provided the old format can support the file system
170 configuration. In interactive mode, \fBfsck\fR will list the direction the
171 conversion is to be made and ask whether the conversion should be done. If a
172 negative answer is given, no further operations are done on the file system. In
173 preen mode, the direction of the conversion is listed and done if possible
174 without user interaction. Conversion in preen mode is best used when all the
175 file systems are being converted at once. The format of a file system can be
176 determined from the first line of output from \fBfstyp\fR(1M). Note: the
177 \fBc\fR option is seldom used and is included only for compatibility with
178 pre-4.1 releases. There is no guarantee that this option will be included in
179 future releases.
180 .RE
181
182 .sp
183 .ne 2
184 .na
185 \fB\fBf\fR\fR
186 .ad
187 .sp .6
188 .RS 4n
189 Force checking of file systems regardless of the state of their super block
190 clean flag.
191 .RE
192
193 .sp
194 .ne 2
195 .na
196 \fB\fBp\fR\fR
197 .ad
198 .sp .6
199 .RS 4n
200 Check and fix the file system non-interactively ("preen"). Exit immediately if
201 there is a problem requiring intervention. This option is required to enable
202 parallel file system checking.
203 .RE
204
205 .sp
206 .ne 2
207 .na
208 \fB\fBw\fR\fR
209 .ad
210 .sp .6
211 .RS 4n
212 Check writable file systems only.
213 .RE
214
215 .RE
216
217 .SH EXIT STATUS
218 .sp
219 .ne 2
220 .na
221 \fB\fB0\fR\fR
222 .ad
223 .sp .6
224 .RS 4n
225 file system is unmounted and OK
226 .RE
227
228 .sp
229 .ne 2
230 .na
231 \fB\fB1\fR\fR
232 .ad
233 .sp .6
234 .RS 4n
235 erroneous parameters are specified
236 .RE
237
238 .sp
239 .ne 2
240 .na
241 \fB\fB32\fR\fR
242 .ad
243 .sp .6
244 .RS 4n
245 file system is unmounted and needs checking (\fBfsck\fR \fB-m\fR only)
246 .RE
247
248 .sp
249 .ne 2
250 .na
251 \fB\fB33\fR\fR
252 .ad
253 .sp .6
254 .RS 4n
255 file system is already mounted
256 .RE
257
258 .sp
259 .ne 2
260 .na
261 \fB\fB34\fR\fR
262 .ad
263 .sp .6
264 .RS 4n
265 cannot stat device
266 .RE
267
268 .sp
269 .ne 2
270 .na
271 \fB\fB35\fR\fR
272 .ad
273 .sp .6
274 .RS 4n
275 a filesystem that is mounted read/write was modified - reboot
276 .RE
277
278 .sp
279 .ne 2
280 .na
281 \fB\fB36\fR\fR
282 .ad
283 .sp .6
284 .RS 4n
285 uncorrectable errors detected - terminate normally
286 .RE
287
288 .sp
289 .ne 2
290 .na
291 \fB\fB37\fR\fR
292 .ad
293 .sp .6
294 .RS 4n
295 a signal was caught during processing
296 .RE
297
298 .sp
299 .ne 2
300 .na
301 \fB\fB39\fR\fR
302 .ad
303 .sp .6
304 .RS 4n
305 uncorrectable errors detected - terminate immediately
306 .RE
307
308 .sp
309 .ne 2
310 .na
311 \fB\fB40\fR\fR
312 .ad
313 .sp .6
314 .RS 4n
315 file system is mounted read-only and is OK
316 .RE
317
318 .SH USAGE
319 .sp
320 .LP
321 The \fBfsck\fR command is \fBlarge file aware\fR for UFS file systems, per the
322 \fBlargefile\fR(5) man page.
323 .SH FILES
324 .sp
325 .ne 2
326 .na
327 \fB\fB/etc/default/fs\fR\fR
328 .ad
329 .sp .6
330 .RS 4n
331 default local file system type. Default values can be set for the following
332 flags in \fB/etc/default/fs\fR. For example: \fBLOCAL=ufs.\fR
333 .sp
334 .ne 2
335 .na
336 \fB\fBLOCAL\fR\fR
337 .ad
338 .sp .6
339 .RS 4n
340 The default partition for a command if no FSType is specified.
341 .RE
342
343 .RE
344
345 .sp
346 .ne 2
347 .na
348 \fB\fB/etc/vfstab\fR\fR
349 .ad
350 .sp .6
351 .RS 4n
352 list of default parameters for each file system
353 .RE
354
355 .SH ATTRIBUTES
356 .sp
357 .LP
358 See \fBattributes\fR(5) for descriptions of the following attributes:
359 .sp
360
361 .sp
362 .TS
363 box;
364 c | c
365 l | l .
366 ATTRIBUTE TYPE ATTRIBUTE VALUE
367 _
368 Interface Stability Committed
369 .TE
370
371 .SH SEE ALSO
372 .sp
373 .LP
374 \fBclri\fR(1M), \fBfsck_cachefs\fR(1M), \fBfsck_ufs\fR(1M), \fBfsdb_ufs\fR(1M),
375 \fBfsirand\fR(1M), \fBfstyp\fR(1M), \fBmkfs\fR(1M), \fBmkfs_ufs\fR(1M),
376 \fBmountall\fR(1M), \fBnewfs\fR(1M), \fBreboot\fR( 1M), \fBvfstab\fR(4),
377 \fBattributes\fR(5), \fBlargefile\fR(5), \fBufs\fR(7FS)
378 .SH WARNINGS
379 .sp
380 .LP
381 The operating system buffers file system data. Running \fBfsck\fR on a mounted
382 file system can cause the operating system's buffers to become out of date with
383 respect to the disk. For this reason, the file system should be \fIunmounted\fR
384 when \fBfsck\fR is used. If this is not possible, care should be taken that the
385 system is quiescent and that it is rebooted immediately after \fBfsck\fR is
386 run. Quite often, however, this will not be sufficient. A panic will probably
387 occur if running \fBfsck\fR on a file system modifies the file system.
388 .SH NOTES
389 .sp
390 .LP
391 This command may not be supported for all \fIFSTypes\fR.
392 .sp
393 .LP
394 Starting with Solaris 9, \fBfsck\fR manages extended attribute data on the
395 disk. (See \fBfsattr\fR(5) for a description of extended file attributes.) A
396 file system with extended attributes can be mounted on versions of Solaris that
397 are not attribute-aware (versions prior to Solaris 9), but the attributes will
398 not be accessible and \fBfsck\fR will strip them from the files and place them
399 in \fBlost+found\fR. Once the attributes have been stripped, the file system is
400 completely stable on versions of Solaris that are not attribute-aware, but
401 would be considered corrupted on attribute-aware versions. In the latter
402 circumstance, run the attribute-aware \fBfsck\fR to stabilize the file system
403 before using it in an attribute-aware environment.