HFS is the original Macintosh hard-disk file system from 1985 (Mac OS 8.1 replaced it with HFS+ in 1998). It still appears on classic Mac floppies, hard disks, CD-ROMs and old backups.
Overview
HFS stores a Master Directory Block at 1024 bytes, a volume bitmap, and two B*-trees: the catalog file (folders and files by parent ID and name) and the extents overflow file. Data and resource forks are separate, each with three extents recorded in the catalog. All values are big-endian and names are MacRoman up to 31 characters.
History
Introduced by Apple in 1985, replacing MFS.
Superseded by HFS+ in Mac OS 8.1 (1998).
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.
Collect
Offset
Size
Type
Field
Notes
0x0
1
u8
–
IdOffset
4
u32 BE
–
Collect
Offset
Size
Type
Field
Notes
0x0
1
u8
–
0x0
1
u8
Data Start
IdOffset
4
u32 BE
Key Id
dataStart
4
u32 BE
Child
Hfs Classic B Tree
Offset
Size
Type
Field
Notes
0x8
1
u8
–
0x10
4
u32 BE
Root Node
0x20
2
u16 BE
Node Size
0x24
4
u32 BE
Total Nodes
Build File
Offset
Size
Type
Field
Notes
0x2
1
u8
–
0x4
4
u32 BE
Type
0x8
4
u32 BE
Creator
0xC
2
u16 BE
–
0x14
4
u32 BE
Id
0x1A
4
u32 BE
Data Length
0x1E
4
u32 BE
Allocated Size
0x24
4
u32 BE
Resource Length
0x2C
4
u32 BE
Created
0x30
4
u32 BE
Modified
Build Folder
Offset
Size
Type
Field
Notes
0x4
2
u16 BE
–
0x6
4
u32 BE
Id
0xA
4
u32 BE
Created
0xE
4
u32 BE
Modified
0x1E
2
u16 BE
Flags
Find Root
Offset
Size
Type
Field
Notes
0x0
1
u8
–
0x6
4
u32 BE
–
Fork Runs
Offset
Size
Type
Field
Notes
0x1
1
u8
–
0x6
2
u16 BE
R
Try Parse
Offset
Size
Type
Field
Notes
0x0
2
u16 BE
–
0x2
4
u32 BE
Created
0x6
4
u32 BE
Modified
0xA
2
u16 BE
Attributes
0xE
2
u16 BE
Bitmap Start Sector
0x12
2
u16 BE
Blocks
0x14
4
u32 BE
Block Size
0x1C
2
u16 BE
First Allocation Sector
0x22
2
u16 BE
Free Blocks
0x24
1
u8
Name Length
0x54
4
u32 BE
File Count
0x58
4
u32 BE
Folder Count
0x7C
2
u16 BE
Embedded Signature
0x82
4
u32 BE
Extents File Size
0x92
4
u32 BE
Catalog File Size
Parse Record
Offset
Size
Type
Field
Notes
offset + i * 4 + 2
2
u16 BE
–
offset + i * 4
2
u16 BE
–
Other fields read
Read in
Offset
Size
Type
Field
Notes
Fork Runs
0x6
2
u16 BE
–
Constants
Hfs Master Directory Block
Name
Value
Type
Notes
Signature
0x4244
ushort
“BD”
Hfs Classic Text
Name
Value
Type
Notes
Epoch
new(1904, 1, 1, 0, 0, 0, TimeSpan.Zero)
DateTimeOffset
MacRomanEncoding
LoadMacRoman()
Encoding
Hfs Classic B Tree
Name
Value
Type
Notes
IdOffset
2
int
Hfs Classic File System
Name
Value
Type
Notes
RootFolderId
2
uint
ExtentsFileId
3
uint
CatalogFileId
4
uint
DirectoryRecord
1
byte
FileRecord
2
byte
DirectoryThread
3
byte
DataFork
0x00
byte
ResourceFork
0xFF
byte
FinderInvisible
0x4000
ushort
Implementation limits
Class
Name
Value
Notes
Hfs Classic B Tree
MaxDepth
16
Structures and constants were extracted from the implementation. Prose sections are a summary from public sources; verify details before relying on them.