]> git.cameronkatri.com Git - apple_cmds.git/blob - diskdev_cmds/fsck.tproj/fsck.8
md5: Don't symlink non working bins, setuid appropriate bins
[apple_cmds.git] / diskdev_cmds / fsck.tproj / fsck.8
1 .\" Copyright (c) 1980, 1989, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
33 .\"
34 .Dd May 18, 2010
35 .Dt FSCK 8
36 .Os BSD 4
37 .Sh NAME
38 .Nm fsck
39 .Nd filesystem consistency check and interactive repair
40 .Sh SYNOPSIS
41 .Nm fsck
42 .Fl p
43 .Op Fl f
44 .Nm fsck
45 .Op Fl l Ar maxparallel
46 .Op Fl q
47 .Op Fl y
48 .Op Fl n
49 .Op Fl d
50 .Sh DESCRIPTION
51 The first form of
52 .Nm fsck
53 preens a standard set of filesystems or the specified filesystems.
54 It is normally used in the script
55 .Pa /etc/rc
56 during automatic reboot.
57 Here
58 .Nm fsck
59 reads the filesystem descriptor table (using
60 .Xr getfsent 3 )
61 to determine which filesystems to check.
62 Only partitions that have ``rw,'' ``rq'' or ``ro'' as options,
63 and that have non-zero pass number are checked.
64 Filesystems with pass number 1 (normally just the root filesystem)
65 are checked one at a time.
66 When pass 1 completes, all remaining filesystems are checked,
67 running one process per disk drive.
68 The disk drive containing each filesystem is inferred from the shortest prefix
69 of the device name that ends in one or more digits; the remaining characters
70 are assumed to be the partition designator.
71 In preening mode,
72 filesystems that are marked clean are skipped.
73 Filesystems are marked clean when they are unmounted,
74 when they have been mounted read-only, or when
75 .Nm fsck
76 runs on them successfully.
77 .Pp
78 It should be noted that
79 .Nm fsck
80 is now essentially a wrapper that invokes other
81 .Pa fsck_XXX
82 utilities as needed. Currently,
83 .Nm fsck
84 can invoke
85 .Pa fsck_hfs ,
86 .Pa fsck_apfs ,
87 .Pa fsck_msdos ,
88 .Pa fsck_exfat ,
89 and
90 .Pa fsck_udf .
91 If this underlying process that
92 .Nm fsck
93 invokes encounters serious inconsistencies or the filesystem type is not one
94 of the above, it exits
95 with an abnormal return status and an automatic reboot will then fail.
96 For each corrected inconsistency one or more lines will be printed
97 identifying the filesystem on which the correction will take place,
98 and the nature of the correction.
99 .Pp
100 If sent a
101 .Dv QUIT
102 signal,
103 .Nm fsck
104 will finish the filesystem checks, then exit with an abnormal
105 return status that causes an automatic reboot to fail.
106 This is useful when you want to finish the filesystem checks during an
107 automatic reboot,
108 but do not want the machine to come up multiuser after the checks complete.
109 .Pp
110 Without the
111 .Fl p
112 option,
113 .Nm fsck
114 audits and interactively repairs inconsistent conditions for filesystems.
115 It should be noted that some of the corrective actions which are not
116 correctable under the
117 .Fl p
118 option will result in some loss of data.
119 The amount and severity of data lost may be determined from the diagnostic
120 output.
121 If the operator does not have write permission on the filesystem
122 .Nm fsck
123 will default to a
124 .Fl n
125 action.
126 .Pp
127 The following flags are interpreted by
128 .Nm fsck
129 and passed along to the underlying tool that it spawns.
130 .Bl -tag
131 .It Fl f
132 Force fsck to check `clean' filesystems when preening.
133 .It Fl l
134 Limit the number of parallel checks to the number specified in the following
135 argument.
136 By default, the limit is the number of disks, running one process per disk.
137 If a smaller limit is given, the disks are checked round-robin, one filesystem
138 at a time.
139 .It Fl R
140 Specify a particular passno number for which fsck is to check. You may only specify 1 or 2.
141 Only those filesystems matching that particular passno entry (if using fstab) will be checked.
142 For more information on the passno field, see
143 .Xr fstab 5 .
144 .It Fl p
145 "Preen" mode, described above.
146 .It Fl q
147 Do a quick check to determine if the filesystem was unmounted cleanly.
148 .It Fl y
149 Assume a yes response to all questions asked by
150 .Nm fsck ;
151 this should be used with great caution as this is a free license
152 to continue after essentially unlimited trouble has been encountered.
153 .It Fl n
154 Assume a no response to all questions asked by
155 .Nm fsck
156 except for
157 .Ql CONTINUE? ,
158 which is assumed to be affirmative;
159 do not open the filesystem for writing.
160 .El
161 .Pp
162 If no filesystems are given to
163 .Nm fsck
164 then a default list of filesystems is read using
165 .Xr getfsent 3 .
166 .Pp
167 Because of inconsistencies between the block device and the buffer cache,
168 the raw device should always be used.
169 .Sh SEE ALSO
170 .Xr fs 5 ,
171 .Xr fsck_hfs 8 ,
172 .Xr fsck_apfs 8 ,
173 .Xr fsck_msdos 8 ,
174 .Xr getfsent 3 ,
175 .Xr fstab 5,
176 .Xr reboot 8