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 800Kb double-sided disks instead of just the single-sided 400Kb floppy disks supported by MFS. However, filenames were limited to 31-characters.

Unlike the flat file structure used in MFS (MFS stored the directory listings in a table in 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 64Kb to 4Gb. Unfortunately, the one place 16-bit integers were still used was in the Desktop directory file, which limited the maximum number of files on each logical disk to 65536.

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, 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.