]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sbin/fsck/fsck.8
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.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 .Op Fl c Ar fstab
45 .Oo Ar special | node Oc ...
46 .Sh DESCRIPTION
47 The
48 .Nm
49 utility invokes file system-specific programs to check
50 the special devices listed in the
51 .Xr fstab 5
52 file or in the command line for consistency.
53 .Pp
54 It is normally used in the script
55 .Pa /etc/rc
56 during automatic reboot.
57 Traditionally,
58 .Nm
59 is invoked before the file systems are mounted
60 and all checks are done to completion at that time.
61 If background checking is available,
62 .Nm
63 is invoked twice.
64 It is first invoked at the traditional time,
65 before the file systems are mounted, with the
66 .Fl F
67 flag to do checking on all the file systems
68 that cannot do background checking.
69 It is then invoked a second time,
70 after the system has completed going multiuser, with the
71 .Fl B
72 flag to do checking on all the file systems
73 that can do background checking.
74 Unlike the foreground checking,
75 the background checking is started asynchronously
76 so that other system activity can proceed
77 even on the file systems that are being checked.
78 .Pp
79 If no file systems are specified,
80 .Nm
81 reads the table
82 .Pa /etc/fstab
83 to determine which file systems to check.
84 Only partitions in
85 .Pa /etc/fstab
86 that are mounted
87 .Dq rw ,
88 .Dq rq
89 or
90 .Dq ro
91 and that have non-zero pass number are checked.
92 File systems with pass number 1 (normally just the root file system)
93 are always checked one at a time.
94 .Pp
95 If not in preen mode, the remaining entries are checked in order of
96 increasing pass number one at a time.
97 This is needed when interaction with
98 .Nm
99 is required.
100 .Pp
101 In preen mode, after pass 1 completes, all remaining file systems are checked,
102 in pass number order running one process per disk drive in parallel for each
103 pass number in increasing order.
104 .Pp
105 In other words: In preen mode all pass 1 partitions are checked sequentially.
106 Next all pass 2 partitions are checked in parallel, one process per disk drive.
107 Next all pass 3 partitions are checked in parallel, one process per disk drive.
108 etc.
109 .Pp
110 The disk drive containing each file system is inferred from the shortest prefix
111 of the device name that ends in a digit; the remaining characters are assumed
112 to be the partition and slice designators.
113 .Pp
114 The options are as follows:
115 .Bl -tag -width indent
116 .It Fl C
117 Check if the
118 .Dq clean
119 flag is set in the superblock and skip file system checks if file system was
120 properly dismounted and marked clean.
121 .It Fl c Ar fstab
122 Specify the
123 .Pa fstab
124 file to use.
125 .It Fl d
126 Debugging mode.
127 Just print the commands without executing them.
128 Available
129 only if
130 .Nm
131 is compiled to support it.
132 .It Fl f
133 Force checking of file systems, even when they are marked clean (for file systems
134 that support this).
135 .It Fl n
136 Causes
137 .Nm
138 to assume no as the answer to all operator questions, except "CONTINUE?".
139 .It Fl p
140 Enter preen mode.
141 In preen mode, only a restricted class of innocuous
142 file system inconsistencies will be corrected.
143 If unexpected inconsistencies caused by hardware or
144 software failures are encountered, the check program
145 will exit with a failure.
146 See the manual pages for the individual check programs
147 for a list of the sorts of failures that they correct
148 when running in preen mode.
149 .It Fl F
150 Run in foreground mode.
151 The check program for each file system is invoked with the
152 .Fl F
153 flag to determine whether it wishes to run as part of
154 the boot up sequence,
155 or if it is able to do its job in background after the
156 system is up and running.
157 A non-zero exit code indicates that it wants to run in foreground
158 and the check program is invoked.
159 A zero exit code indicates that it is able to run later in background
160 and just a deferred message is printed.
161 .It Fl B
162 Run in background mode.
163 The check program for each file system is invoked with the
164 .Fl F
165 flag to determine whether it wishes to run as part of
166 the boot up sequence,
167 or if it is able to do its job in background after the
168 system is up and running.
169 A non-zero exit code indicates that it wanted to run in foreground
170 which is assumed to have been done, so the file system is skipped.
171 A zero exit code indicates that it is able to run in background
172 so the check program is invoked with the
173 .Fl B
174 flag to indicate that a check on the active file system should be done.
175 When running in background mode,
176 only one file system at a time will be checked.
177 Note that background
178 .Nm
179 is limited to checking for only the most commonly occurring
180 file system abnormalities.
181 Under certain circumstances,
182 some errors can escape background
183 .Nm .
184 It is recommended that you perform foreground
185 .Nm
186 on your systems periodically and whenever you encounter
187 file-system\-related panics.
188 .It Fl t Ar fstype
189 Invoke
190 .Nm
191 only for the comma separated list of file system types.
192 If the
193 list starts with
194 .Dq no
195 then invoke
196 .Nm
197 for the file system types that are not specified in the list.
198 .It Fl v
199 Print the commands before executing them.
200 .It Fl y
201 Causes
202 .Nm
203 to assume yes
204 as the answer to all operator questions.
205 .It Fl T Ar fstype : Ns Ar fsoptions
206 List of comma separated file system specific options for the specified
207 file system type, in the same format as
208 .Xr mount 8 .
209 .El
210 .Sh FILES
211 .Bl -tag -width /etc/fstab -compact
212 .It Pa /etc/fstab
213 file system table
214 .El
215 .Sh SEE ALSO
216 .Xr fstab 5 ,
217 .Xr fsck_ffs 8 ,
218 .Xr fsck_msdosfs 8 ,
219 .Xr mount 8