HFS+ (Mac OS Extended) was the standard Mac file system from 1998 to macOS 10.12 and remains on older Macs, Time Machine backups and many external drives. It adds Unicode names, journaling (10.2.2) and large volumes, and was replaced by APFS.
Overview
HFS+ keeps a volume header at 1024 bytes (with a backup near the end) and five special files: allocation, extents overflow, catalog, attributes and startup. All are B-trees except the allocation file. Names are UTF-16 (Unicode decomposed form), block numbers are 32-bit, and optional journaling and HFSX case sensitivity exist. Transparent compression (decmpfs) stores data in an extended attribute or the resource fork.
History
Introduced in Mac OS 8.1 (1998).
Journaling arrived in Mac OS X 10.2.2 and case-sensitive HFSX in 10.3.
Replaced by APFS for flash in macOS 10.13 (2017).
Structures
Offsets are in bytes from the start of the structure named in each heading. Field names are descriptive and are not an official specification. Fixed-width integers are shown as u/i (unsigned/signed) followed by bit width and byte order.
Decode Zlib Resource Fork
Offset
Size
Type
Field
Notes
0x0
4
u32 BE
Data Offset
(int)tableBase
4
u32 LE
Count
entry
4
u32 LE
Offset
entry + 4
4
u32 LE
Length
Try Parse Header
Offset
Size
Type
Field
Notes
0x0
4
u32 LE
–
0x4
4
u32 LE
Ethod
0x8
8
u64 LE
Uncompressed Size
Collect
Offset
Size
Type
Field
Notes
0x0
2
u16 BE
Key End
_idOffset
4
u32 BE
Key Id
dataStart
4
u32 BE
Child
Hfs B Tree
Offset
Size
Type
Field
Notes
0x8
1
u8
–
h
2
u16 BE
Depth
h + 2
4
u32 BE
Root Node
h + 18
2
u16 BE
Node Size
h + 20
2
u16 BE
Max Key Length
h + 22
4
u32 BE
Total Nodes
h + 37
1
u8
Key Compare Type
h + 38
4
u32 BE
Attributes
Parse
Offset
Size
Type
Field
Notes
0x8
1
u8
Kind
0x9
1
u8
Height
0xA
2
u16 BE
Count
data.Length – 2 * (i + 1)
2
u16 BE
Offset
Build File
Offset
Size
Type
Field
Notes
0x2
2
u16 BE
Flags
0x8
4
u32 BE
Id
0x2C
4
u32 BE
Link Reference
0x30
4
u32 BE
File Type
0x34
4
u32 BE
Creator
Build File Content
Offset
Size
Type
Field
Notes
0x2
2
u16 BE
Flags
0x8
4
u32 BE
Content Id
0xC
4
u32 BE
Created
0x10
4
u32 BE
Modified
0x14
4
u32 BE
Changed
0x18
4
u32 BE
Accessed
0x29
1
u8
Owner Flags
0x2A
2
u16 BE
Ode
0x30
4
u32 BE
File Type
0x34
4
u32 BE
Creator
Build Folder
Offset
Size
Type
Field
Notes
0x2
2
u16 BE
Flags
0x4
4
u32 BE
–
0x8
4
u32 BE
Id
0xC
4
u32 BE
Created
0x10
4
u32 BE
Modified
0x14
4
u32 BE
Changed
0x18
4
u32 BE
Accessed
Common Details
Offset
Size
Type
Field
Notes
0x20
4
u32 BE
–
0x24
4
u32 BE
–
0x2A
2
u16 BE
Ode
Fork Runs
Offset
Size
Type
Field
Notes
0x2
1
u8
–
0x8
4
u32 BE
R
Hfs Plus File System
Offset
Size
Type
Field
Notes
VhAttributes
4
u32 BE
Is Journaled
VhAttributes
4
u32 BE
Was Cleanly Unmounted
VhFreeBlocks
4
u32 BE
Free Bytes
VhFinderInfo + 24
8
u64 BE
Id
Hfs Plus File System
Offset
Size
Type
Field
Notes
VhBlockSize
4
u32 BE
Block Size
VhSignature
2
u16 BE
Is Hfsx
VhTotalBlocks
4
u32 BE
Total Blocks
Load Attributes
Offset
Size
Type
Field
Notes
0x0
4
u32 BE
Record Type
0xC
4
u32 BE
Size
Volume Details
Offset
Size
Type
Field
Notes
VhFileCount
4
u32 BE
–
VhFolderCount
4
u32 BE
–
VhModifyDate
4
u32 BE
–
Is Volume Header
Offset
Size
Type
Field
Notes
VhBlockSize
4
u32 BE
Block Size
VhSignature
2
u16 BE
Signature
VhTotalBlocks
4
u32 BE
–
VhVersion
2
u16 BE
Version
Locate Embedded Volume
Offset
Size
Type
Field
Notes
MdbAllocationBlockSize
4
u32 BE
Block Size
MdbEmbedCount
2
u16 BE
Length
MdbEmbedSignature
2
u16 BE
–
MdbEmbedStart
2
u16 BE
Start
MdbFirstAllocationBlock
2
u16 BE
Start
Probe
Offset
Size
Type
Field
Notes
0x0
2
u16 BE
Signature
VhBlockSize
4
u32 BE
Length
VhTotalBlocks
4
u32 BE
Length
Probe Wrapper
Offset
Size
Type
Field
Notes
MdbAllocationBlockSize
4
u32 BE
–
MdbEmbedSignature
2
u16 BE
–
MdbFirstAllocationBlock
2
u16 BE
Wrapper Length
MdbTotalBlocks
2
u16 BE
–
Parse
Offset
Size
Type
Field
Notes
0x0
8
u64 BE
Logical Size
0xC
4
u32 BE
Total Blocks
Parse Extents
Offset
Size
Type
Field
Notes
offset + i * 8 + 4
4
u32 BE
–
offset + i * 8
4
u32 BE
–
Other fields read
Read in
Offset
Size
Type
Field
Notes
Index Data Start
0x0
2
u16 BE
–
Next Key Id
_idOffset
4
u32 BE
Max Value
Build Entry
CatalogKeyIdOffset
4
u32 BE
Parent Id
Find By Cnid
0x8
4
u32 BE
–
Find By Cnid
0x4
4
u32 BE
Parent Id
Find Private
0x8
4
u32 BE
–
Finder Flags
0x38
2
u16 BE
–
Fork Runs
0x8
4
u32 BE
–
Load Attributes
0x8
4
u32 BE
Start Block
Mount
0x0
2
u16 BE
–
Uni Str
offset
2
u16 BE
Count
Constants
Decmpfs
Name
Value
Type
Notes
AttributeName
“com.apple.decmpfs”
string
Magic
0x636D7066
uint
“fpmc” on disk
HeaderSize
16
int
Hfs B Tree
Name
Value
Type
Notes
h
NodeDescriptorSize
int
Hfs Const
Name
Value
Type
Notes
VolumeHeaderOffset
1024
int
VolumeHeaderSize
512
int
SignatureHfsPlus
0x482B
ushort
“H+”
SignatureHfsx
0x4858
ushort
“HX”
SignatureHfs
0x4244
ushort
“BD” (HFS wrapper / plain HFS)
VersionHfsPlus
4
ushort
VersionHfsx
5
ushort
HFSPlusVolumeHeader
Name
Value
Type
Notes
VhSignature
0
int
VhVersion
2
int
VhAttributes
4
int
VhJournalInfoBlock
12
int
VhCreateDate
16
int
VhModifyDate
20
int
VhFileCount
32
int
VhFolderCount
36
int
VhBlockSize
40
int
VhTotalBlocks
44
int
VhFreeBlocks
48
int
VhFinderInfo
80
int
VhAllocationFile
112
int
VhExtentsFile
192
int
VhCatalogFile
272
int
VhAttributesFile
352
int
VolumeUnmounted
1u << 8
uint
VolumeJournaled
1u << 13
uint
HFS Master Directory Block (wrapper)
Name
Value
Type
Notes
MdbTotalBlocks
18
int
MdbAllocationBlockSize
20
int
MdbFirstAllocationBlock
28
int
MdbEmbedSignature
124
int
MdbEmbedStart
126
int
MdbEmbedCount
128
int
Special catalog node ids
Name
Value
Type
Notes
RootParentId
1
uint
RootFolderId
2
uint
ExtentsFileId
3
uint
CatalogFileId
4
uint
AllocationFileId
6
uint
AttributesFileId
8
uint
Catalog record types
Name
Value
Type
Notes
FolderRecord
1
short
FileRecord
2
short
FolderThreadRecord
3
short
FileThreadRecord
4
short
FolderRecordSize
88
int
FileRecordSize
248
int
Catalog record flags
Name
Value
Type
Notes
FlagFileLocked
0x1
ushort
FlagHasAttributes
0x4
ushort
FlagHasLinkChain
0x20
ushort
B-tree
Name
Value
Type
Notes
NodeDescriptorSize
14
int
IndexNode
0
sbyte
HeaderNode
1
sbyte
LeafNode
-1
sbyte
VariableIndexKeys
0x4
uint
KeyCompareBinary
0xBC
byte
Offsets of the CNID inside each tree’s keys (after the 2-byte key length)
Name
Value
Type
Notes
CatalogKeyIdOffset
2
int
ExtentsKeyIdOffset
4
int
AttributesKeyIdOffset
4
int
DataFork
0x00
byte
ResourceFork
0xFF
byte
ResourceForkStreamName
“rsrc”
string
Attribute record types
Name
Value
Type
Notes
AttrInlineData
0x10
uint
AttrForkData
0x20
uint
AttrExtents
0x30
uint
Finder info / BSD info
Name
Value
Type
Notes
TypeHardLink
0x686C6E6B
uint
‘hlnk’
CreatorHfsPlus
0x6866732B
uint
‘hfs+’
TypeFolderLink
0x66647270
uint
‘fdrp’
CreatorMacs
0x4D414353
uint
‘MACS’
TypeSymlink
0x736C6E6B
uint
‘slnk’
CreatorRhapsody
0x72686170
uint
‘rhap’
FinderInvisible
0x4000
ushort
OwnerImmutable
0x02
byte
OwnerCompressed
0x20
byte
ModeTypeMask
0xF000
ushort
ModeDirectory
0x4000
ushort
ModeSymlink
0xA000
ushort
PrivateDataFolder
“\0\0\0\0HFS+ Private Data”
string
PrivateDirectoryFolder
“.HFS+ Private Directory Data\r”
string
Be
Name
Value
Type
Notes
HfsEpoch
new(1904, 1, 1, 0, 0, 0, TimeSpan.Zero)
DateTimeOffset
Hfs Fork
Name
Value
Type
Notes
Size
80
int
Implementation limits
Class
Name
Value
Notes
Decmpfs
MaxInMemory
int.MaxValue
decompressed content is buffered in memory
Decmpfs
ChunkSize
64 * 1024
Hfs B Tree
MaxDepth
16
Hfs B Tree
MaxCachedNodes
4096
Hfs Plus File System
MaxAllocationBitmap
512L * 1024 * 1024
Hfs Plus File System
MaxSymlinkLength
4096
Structures and constants were extracted from the implementation. Prose sections are a summary from public sources; verify details before relying on them.