Hierarchical File System

The Hierarchical File System (HFS), also known as the Mac OS Standard format, was introduced by Apple Computer in September 1985 to replace the Macintosh File System (MFS) with a more robust format that provided support for Macintosh disks of arbitrary sizes and layouts. It notably supported Apple's new HD20 hard disk drives (featuring 20 MB of storage) and 800 KB double-sided disks instead of just the single-sided 400 KB floppy disks supported by MFS. However, filenames were limited to 31-characters.

Description
Unlike the flat file structure used in MFS (MFS stored the directory listings in a table within the Desktop file), HFS contained an internal catalog file based on B-trees. Data in HFS was stored using 32-bit integers instead of 16-bit integers, providing maximum values of 4096x1024^2 instead of 65536. This impacted things such as maximum file size, which rose from 64 KB to 4 GB. Unfortunately, the one place 16-bit integers were continued to be used was in the Desktop directory file, which was resource-based and limited the maximum number of files on each logical volume to 65536. AppleShare 2.0, and later System 7, split this into two data files named Desktop DB and Desktop DF to improve performance. Maximum drive volume was still limited to 2 GB, which increased to 4 GB with the release of System 7.5 in 1994.

Replacements
HFS remained the primary file system format used by Apple's computers until HFS Plus (also known as Mac OS Extended) was released in 1998 as part of Mac OS 8.1, finally adding 32-bit support for block addresses and the mapping table (allowing for drive sizes up to 8 exabytes), and switching from Mac OS Roman to Unicode for character representation. HFS contained no transaction journal, so mild data corruption due to interrupted cached writes to disk would require a complete rebuild of the B-Tree, often resulting in the loss of files and file data.

The timestamp is stored as a single 32-bit value which starts at January 1, 1904 and runs out at February 6, 2040. After this date, the clock will cycle back to 1904. This limitation is independent of the 2020 date limit of Mac OS 8.6.1 and earlier. The 2040 date limit was not resolved until Apple introduced the Apple File System (APFS) as part of macOS 10.13 in September 2017.