]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sbin/fsck/fsck.8
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sbin / fsck / fsck.8
1 .\"     $NetBSD: fsck.8,v 1.19 1999/03/10 00:08:33 erh Exp $
2 .\"
3 .\" Copyright (c) 1996 Christos Zoulas.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\"    must display the following acknowledgement:
15 .\"     This product includes software developed by Christos Zoulas.
16 .\" 4. The name of the author may not be used to endorse or promote products
17 .\"    derived from this software without specific prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 .\"
30 .\" $FreeBSD$
31 .\"
32 .Dd January 25, 2009
33 .Dt FSCK 8
34 .Os
35 .Sh NAME
36 .Nm fsck
37 .Nd file system consistency check and interactive repair
38 .Sh SYNOPSIS
39 .Nm
40 .Op Fl Cdfnpvy
41 .Op Fl B | F
42 .Op Fl T Ar fstype : Ns Ar fsoptions
43 .Op Fl t Ar fstype
44 .Oo Ar special | node Oc ...
45 .Sh DESCRIPTION
46 The
47 .Nm
48 utility invokes file system-specific programs to check
49 the special devices listed in the
50 .Xr fstab 5
51 file or in the command line for consistency.
52 .Pp
53 It is normally used in the script
54 .Pa /etc/rc
55 during automatic reboot.
56 Traditionally,
57 .Nm
58 is invoked before the file systems are mounted
59 and all checks are done to completion at that time.
60 If background checking is available,
61 .Nm
62 is invoked twice.
63 It is first invoked at the traditional time,
64 before the file systems are mounted, with the
65 .Fl F
66 flag to do checking on all the file systems
67 that cannot do background checking.
68 It is then invoked a second time,
69 after the system has completed going multiuser, with the
70 .Fl B
71 flag to do checking on all the file systems
72 that can do background checking.
73 Unlike the foreground checking,
74 the background checking is started asynchronously
75 so that other system activity can proceed
76 even on the file systems that are being checked.
77 .Pp
78 If no file systems are specified,
79 .Nm
80 reads the table
81 .Pa /etc/fstab
82 to determine which file systems to check.
83 Only partitions in
84 .Pa /etc/fstab
85 that are mounted
86 .Dq rw ,
87 .Dq rq
88 or
89 .Dq ro
90 and that have non-zero pass number are checked.
91 File systems with pass number 1 (normally just the root file system)
92 are always checked one at a time.
93 .Pp
94 If not in preen mode, the remaining entries are checked in order of
95 increasing pass number one at a time.
96 This is needed when interaction with
97 .Nm
98 is required.
99 .Pp
100 In preen mode, after pass 1 completes, all remaining file systems are checked,
101 in pass number order running one process per disk drive in parallel for each
102 pass number in increasing order.
103 .Pp
104 In other words: In preen mode all pass 1 partitions are checked sequentially.
105 Next all pass 2 partitions are checked in parallel, one process per disk drive.
106 Next all pass 3 partitions are checked in parallel, one process per disk drive.
107 etc.
108 .Pp
109 The disk drive containing each file system is inferred from the shortest prefix
110 of the device name that ends in a digit; the remaining characters are assumed
111 to be the partition and slice designators.
112 .Pp
113 The options are as follows:
114 .Bl -tag -width indent
115 .It Fl C
116 Check if the
117 .Dq clean
118 flag is set in the superblock and skip file system checks if file system was
119 properly dismounted and marked clean.
120 .It Fl d
121 Debugging mode.
122 Just print the commands without executing them.
123 Available
124 only if
125 .Nm
126 is compiled to support it.
127 .It Fl f
128 Force checking of file systems, even when they are marked clean (for file systems
129 that support this).
130 .It Fl n
131 Causes
132 .Nm
133 to assume no as the answer to all operator questions, except "CONTINUE?".
134 .It Fl p
135 Enter preen mode.
136 In preen mode, only a restricted class of innocuous
137 file system inconsistencies will be corrected.
138 If unexpected inconsistencies caused by hardware or
139 software failures are encountered, the check program
140 will exit with a failure.
141 See the manual pages for the individual check programs
142 for a list of the sorts of failures that they correct
143 when running in preen mode.
144 .It Fl F
145 Run in foreground mode.
146 The check program for each file system is invoked with the
147 .Fl F
148 flag to determine whether it wishes to run as part of
149 the boot up sequence,
150 or if it is able to do its job in background after the
151 system is up and running.
152 A non-zero exit code indicates that it wants to run in foreground
153 and the check program is invoked.
154 A zero exit code indicates that it is able to run later in background
155 and just a deferred message is printed.
156 .It Fl B
157 Run in background mode.
158 The check program for each file system is invoked with the
159 .Fl F
160 flag to determine whether it wishes to run as part of
161 the boot up sequence,
162 or if it is able to do its job in background after the
163 system is up and running.
164 A non-zero exit code indicates that it wanted to run in foreground
165 which is assumed to have been done, so the file system is skipped.
166 A zero exit code indicates that it is able to run in background
167 so the check program is invoked with the
168 .Fl B
169 flag to indicate that a check on the active file system should be done.
170 When running in background mode,
171 only one file system at a time will be checked.
172 Note that background
173 .Nm
174 is limited to checking for only the most commonly occurring
175 file system abnormalities.
176 Under certain circumstances,
177 some errors can escape background
178 .Nm .
179 It is recommended that you perform foreground
180 .Nm
181 on your systems periodically and whenever you encounter
182 file-system\-related panics.
183 .It Fl t Ar fstype
184 Invoke
185 .Nm
186 only for the comma separated list of file system types.
187 If the
188 list starts with
189 .Dq no
190 then invoke
191 .Nm
192 for the file system types that are not specified in the list.
193 .It Fl v
194 Print the commands before executing them.
195 .It Fl y
196 Causes
197 .Nm
198 to assume yes
199 as the answer to all operator questions.
200 .It Fl T Ar fstype : Ns Ar fsoptions
201 List of comma separated file system specific options for the specified
202 file system type, in the same format as
203 .Xr mount 8 .
204 .El
205 .Sh FILES
206 .Bl -tag -width /etc/fstab -compact
207 .It Pa /etc/fstab
208 file system table
209 .El
210 .Sh SEE ALSO
211 .Xr fstab 5 ,
212 .Xr fsck_ffs 8 ,
213 .Xr fsck_msdosfs 8 ,
214 .Xr mount 8