HPFS (High Performance File System)

HPFS is the OS/2 file system from IBM and Microsoft (1989), also usable by Windows NT 3.x until NT 4.0 dropped it. It is obsolete today and turns up on old OS/2, eComStation and ArcaOS disks and in dual-boot images.

Overview

HPFS organizes the disk in 512-byte sectors grouped into bands with free-space bitmaps. A superblock at sector 16 and a spare block at sector 17 point to the root fnode. Directories are B-trees of entries held in 2 KiB dirblocks, and file data is mapped by fnodes with run lists. Names may be up to 254 characters, are case-preserving and can carry extended attributes.

History

  • Co-developed by IBM and Microsoft for OS/2 1.2 (1989).
  • Windows NT 3.1 and 3.5 could use it; support was dropped from NT 4.0 in favor of NTFS.

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.

Load Code Pages

OffsetSizeTypeFieldNotes
0x04u32 LE–
0x44u32 LECount
0xC4u32 LESector
at + 22u16 LECode Page
at + 0x0C2u16 LEIndex

Load Hotfixes

OffsetSizeTypeFieldNotes
(int)(i + total) * 44u32 LEReplacement
(int)i * 44u32 LEBad

Read Allocation

OffsetSizeTypeFieldNotes
at4u32 LE–
at + 44u32 LESectors
header + 8 + i * 8 + 44u32 LEAlsec
header + 51u8Used
at + 84u32 LE–

Walk

OffsetSizeTypeFieldNotes
0x04u32 LE–
0x44u32 LEFirst Free

Parse Freed Fnode

OffsetSizeTypeFieldNotes
FnodeContainingDir4u32 LEParent
FnodeEaInternalSize2u16 LEEa Size
FnodeEaRunSize4u32 LEEa Size
FnodeFileSize4u32 LESize

Mount

OffsetSizeTypeFieldNotes
0x274u32 LENumber
0x364bytes–

Hpfs Const

OffsetSizeTypeFieldNotes
o4u32 LE–
o2u16 LE–

Parse

OffsetSizeTypeFieldNotes
0x04u32 LE–
0x44u32 LE–
0x81u8Flags
0xC4u32 LEHotfix List
0x104u32 LEHotfixes Used
0x144u32 LEHotfixes Max
0x204u32 LECode Page Info

Parse

OffsetSizeTypeFieldNotes
0x04u32 LE–
0x44u32 LE–
0x81u8Version
0x91u8Functional Version
0xC4u32 LERoot Fnode
0x104u32 LETotal Sectors
0x144u32 LEBad Sectors
0x184u32 LEBitmap List
0x284u32 LELast Chkdsk
0x344u32 LEDir Band Start
0x384u32 LEDir Band End

Parse

OffsetSizeTypeFieldNotes
offset2u16 LELength
offset + 21u8Flags
offset + 31u8–
offset + 44u32 LE–
offset + length – 44u32 LE–
offset + 84u32 LE–
offset + 0x0C4u32 LE–
offset + 0x104u32 LE–
offset + 0x144u32 LE–
offset + 0x184u32 LE–
offset + 0x1D1u8–
offset + 0x1E1u8Name Length

Other fields read

Read inOffsetSizeTypeFieldNotes
Folder Dir BlockFnodeAllocation + 8 + 84u32 LE–first ALLEAF’s disk sector
From DirentFnodeFileSize4u32 LESize
Load Bitmapband * 44u32 LESector
Read Allocation0x04u32 LE–
Read Sectors0x04u32 LE–

Constants

Hpfs Const

NameValueTypeNotes
SectorSize512int
DirBlockSectors4int
DirBlockSizeDirBlockSectors * SectorSizeint
SectorsPerBand16384int
SuperblockLsn16uint
SpareblockLsn17uint
SuperMagic10xF995E849uint
SuperMagic20xFA53E9C5uint
SpareMagic10xF9911849uint
SpareMagic20xFA5229C5uint
FnodeMagic0xF7E40AAEuint
AlsecMagic0x37E40AAEuint
DirBlockMagic0x77E40AAEuint
CodePageInfoMagic0x494521F7uint

FNODE

NameValueTypeNotes
FnodeNameLength0x0Cint
FnodeName0x0Dint
FnodeContainingDir0x1Cint
FnodeEaRunSize0x2Cint
FnodeEaInternalSize0x34int
FnodeFlags0x37int
FnodeAllocation0x38int
FnodeFileSize0xA0int
FnodeIsDirectory0x01byte

Allocation block header flags

NameValueTypeNotes
AllocNodes0x80byte

DIRENT

NameValueTypeNotes
DirentSpecial0x01byte
DirentDown0x04byte
DirentEnd0x08byte
DirentNameOffset0x1Fint
AttrReadOnly0x01byte
AttrHidden0x02byte
AttrSystem0x04byte
AttrDirectory0x10byte
AttrArchive0x20byte

Implementation limits

ClassNameValueNotes
Hpfs File SystemMaxTreeDepth32
Hpfs File SystemMaxLostEntries100_000
Hpfs File SystemScanChunkSectors2048
Hpfs File SystemMaxRecoverabilitySectors16 * 1024 * 1024

Signatures and magic strings referenced

TextWhere checked
HPFSMount
Structures and constants were extracted from the implementation. Prose sections are a summary from public sources; verify details before relying on them.