]> git.saurik.com Git - apple/hfs.git/blame - fsck_hfs/fsck_hfs.8
hfs-556.100.11.tar.gz
[apple/hfs.git] / fsck_hfs / fsck_hfs.8
CommitLineData
51e135ce
A
1.\" Copyright (c) 2002,2008 Apple Inc. All rights reserved.
2.\"
3.\" The contents of this file constitute Original Code as defined in and
4.\" are subject to the Apple Public Source License Version 1.1 (the
5.\" "License"). You may not use this file except in compliance with the
6.\" License. Please obtain a copy of the License at
7.\" http://www.apple.com/publicsource and read it before using this file.
8.\"
9.\" This Original Code and all software distributed under the License are
10.\" distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
11.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
12.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
13.\" FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
14.\" License for the specific language governing rights and limitations
15.\" under the License.
16.\"
17.\" @(#)fsck_hfs.8
18.Dd August 5, 2008
19.Dt FSCK_HFS 8
20.Os "Mac OS X"
21.Sh NAME
22.Nm fsck_hfs
23.Nd HFS file system consistency check
24.Sh SYNOPSIS
25.Nm fsck_hfs
26.Fl q
27.Op Fl df
28.Ar special ...
29.Nm fsck_hfs
30.Fl p
31.Op Fl df
32.Ar special ...
33.Nm fsck_hfs
34.Op Fl n | y | r
35.Op Fl dfgxlES
36.Op Fl D Ar flags
37.Op Fl b Ar size
38.Op Fl B Ar path
39.Op Fl m Ar mode
40.Op Fl c Ar size
41.Op Fl R Ar flags
42.Ar special ...
43.Sh DESCRIPTION
44.Pp
45The
46.Nm
47utility verifies and repairs standard HFS and HFS+ file systems.
48.Pp
49The first form of
50.Nm
51quickly checks the specified file systems to determine whether
52they were cleanly unmounted.
53.Pp
54The second form of
55.Nm
56preens the specified file systems.
57It is normally started by
58.Xr fsck 8
59run from
60.Pa /etc/rc.boot
61during automatic reboot, when a HFS file system is detected.
62When preening file systems,
63.Nm
64will fix common inconsistencies for file systems that were not
65unmounted cleanly.
66If more serious problems are found,
67.Nm
68does not try to fix them, indicates that it was not
69successful, and exits.
70.Pp
71The third form of
72.Nm
73checks the specified file systems and tries to repair all
74detected inconsistencies.
75.Pp
76If no options are specified
77.Nm
78will always check and attempt to fix the specified file systems.
79.Pp
80The options are as follows:
81.Bl -hang -offset indent
82.It Fl c Ar size
83Specify the
84.Ar size
85of the cache used by
86.Nm
87internally. Bigger
88.Ar size
89can result in better performance but can result in deadlock when
90used with
91.Fl l
92option. Size can be specified as a decimal, octal, or
93hexadecimal number. If the number ends with a ``k'', ``m'',
94or ``g'', the number is multiplied by 1024 (1K), 1048576 (1M),
95or 1073741824 (1G), respectively.
96.It Fl d
97Display debugging information.
98This option may provide useful information when
99.Nm
100cannot repair a damaged file system.
101.It Fl D Ar flags
102Print extra debugging information. The
103.Ar flags
104are a bitmap that control which kind of debug information is printed.
105The following values are currently implemented:
106.Bl -hang -offset indent -compact
107.It 0x0001
108Informational messages
109.It 0x0002
110Error messages
111.It 0x0010
112Extended attributes related messages
113.It 0x0020
114Overlapped extents related messages
115.El
116.It Fl b Ar size
117Specify the size, in bytes, of the physical blocks used by the
118.Fl B
119option.
120.It Fl B Ar path
121Print the files containing the physical blocks listed in the file
122.Ar path .
123The file should contain one or more decimal, octal (with leading 0) or
124hexadecimal (with leading 0x) numbers separated by white space. The physical
125block numbers are relative to the start of the partition, so if you
126have block numbers relative to the start of the device, you will have to
127subtract the block number of the start of the partition. The size of a
128physical block is given with the
129.Fl b
130option; the default is 512 bytes per block.
131.It Fl f
132When used with the
133.Fl p
134option, force
135.Nm
136to check `clean' file systems, otherwise it means force
137.Nm
138to check and repair journaled HFS+ file systems.
139.It Fl g
140Causes
141.Nm
142to generate its output strings in GUI format.
143This option is used when another application with a graphical user interface
144(like Mac OS X Disk Utility) is invoking the
145.Nm
146tool.
147.It Fl x
148Causes
149.Nm
150to generate its output strings in XML (plist) format. This option
151implies the
152.Fl g
153option.
154.It Fl l
155Lock down the file system and perform a test-only check.
156This makes it possible to check a file system that is currently mounted,
157although no repairs can be made.
158.It Fl m Ar mode
159Mode is an octal number that will be used to set the permissions for the
160lost+found directory when it is created.
161The lost+found directory is only created when a volume is repaired and orphaned
162files or directories are detected.
163.Nm
164places orphaned files and directories into the lost+found directory (located
165at the root of the volume).
166The default mode is 01777.
167.It Fl p
168Preen the specified file systems.
169.It Fl q
170Causes
171.Nm
172to quickly check whether the volume was unmounted cleanly.
173If the volume was unmounted cleanly, then the exit status is 0.
174If the volume was not unmounted cleanly, then the exit status will be non-zero.
175In either case, a message is printed to standard output describing whether the
176volume was clean or dirty.
177.It Fl y
178Always attempt to repair any damage that is found.
179.It Fl n
180Never attempt to repair any damage that is found.
181.It Fl E
182Cause
183.Nm
184to exit (with a value of 47) if it encounters any
185major errors. A ``major error'' is considered one which
186would impact using the volume in normal usage; an inconsistency
187which would not impact such use is considered ``minor'' for this
188option. Only valid with the
189.Fl n
190option.
191.It Fl S
192Cause
193.Nm
194to scan the entire device looking for I/O errors. It will
195attempt to map the blocks with errors to names, similar to
196the
197.Fl B
198option.
199.It Fl R Ar flags
200Rebuilds the requested btree. The following flags are supported:
201.Bl -hang -offset indent -compact
202.It a
203Attribute btree
204.It c
205Catalog btree
206.It e
207Extents overflow btree
208.El
209Rebuilding a btree will only
210work if there is enough free space on the file system for the new btree
211file, and if
212.Nm
213is able to traverse each of the nodes in the requested btree successfully.
214Rebuilding btrees is not supported on HFS Standard volumes.
215.It Fl r
216Rebuild the catalog btree. This is synonymous with
217.Fl Rc .
218.El
219.Pp
220Because of inconsistencies between the block device and the buffer cache,
221the raw device should always be used.
222.Sh EXIT VALUES
223.Nm
224indicates some status by exit value. The current list of exit status results
225is:
226.Bl -hang -offset indent -compact
227.It 0
228No errors found, or successfully repaired.
229.It 3
230A quick-check (the
231.Fl n
ec99dd30
A
232option) found a dirty filesystem; no repairs were made. There is a potential
233corruption in the filesystem, and either the journal could not be read, or a
234runtime corruption was present so the HFS Volume Inconsistent bit was set.
51e135ce
A
235.It 4
236During boot, the root filesystem was found to be dirty; repairs were
237made, and the filesystem was remounted. The system should be rebooted.
238.It 8
239A corrupt filesystem was found during a check, or repairs did not succeed.
240.It 47
241A major error was found with
242.Fl E .
243.El
244.Sh SEE ALSO
245.Xr fsck 8
246.Sh BUGS
247.Nm
248is not able to fix some inconsistencies that it detects.
249.Sh HISTORY
250The
251.Nm
252command appeared in Mac OS X Server 1.0 .