3.2. Apple Macintosh

Macintosh formats originated on the 68K and PowerPC platforms and thus use big-endian byte order. Apple's mystic collection of disk image formats is discussed in Section 3.13.2, “Apple Disk Images”.

3.2.1. The Macintosh File System (MFS)

This file system was used on the first Macs, using 400K floppies. It doesn't support folders (the Mac term for directories), just a flat set of files. The format was quickly replaced by the Hierarchical File System, which did support folders.

disktype only recognizes the volume header signature of MFS.

3.2.2. The Hierarchical File System (HFS)

This file system was used on Macs for many years and for all media (floppies, hard disks, CD-ROMs). It has some special features, like the 4-character type and creator code remembered for each file, and dual-fork files, where the "data fork" stores application-specific data (like on other systems) and the "resource fork" stores additional information in a system-defined chunk format.

The HFS superblock is stored 1024 bytes into the device, independent of sector size (which is assumed to be 512 bytes in general). The allocation block size is usually larger, from 4K to 32K. HFS uses B+-trees to store directory contents and file extents.

HFS hit some limits with growing disk sizes (compare FAT16), and so the HFS+ format was designed as a replacement. HFS is still in widespread use, especially on interchange media, including disk images used for software distribution.

3.2.3. The HFS Plus File System

The HFS+ format was defined to improve shortcomings of HFS. It supports all the features of HFS, but also provides for POSIX file semantics and permissions. It is the primary file system for Mac OS X. Classic Mac OS versions starting with 8.1 also support it.

Like HFS, HFS+ has a superblock 1024 bytes into the device and uses B+-trees to store directory contents and file extents. The block size defaults to 4K.

HFS+ volumes are often "wrapped" inside a dummy HFS volume. The dummy volume contains a ReadMe file, explaining the situation to the user of a pre-8.1 Mac OS release. It also contains a hidden System file, required for booting from a HFS+ volume on some machines. Special fields in the HFS volume header tell HFS+-aware systems where to find the actual volume.

disktype recognizes both wrapped and non-wrapped HFS+ volumes. A wrapped volume will report accordingly, like in the following example:

--- hfs-plus-wrapped.image
Regular file, size 8 MiB (8388608 bytes)
HFS file system
  Volume name "HFS Plus Wrapped"
  Volume size 7.992 MiB (8380416 bytes, 2046 blocks of 4 KiB)
HFS wrapper for HFS Plus
  HFS Plus file system
    Volume size 7.953 MiB (8339456 bytes, 2036 blocks of 4 KiB)
    Volume name "HFS Plus Wrapped"

HFS+ stores the volume name in the directory data B-tree (the "catalog"), not in the volume header. While disktype makes some attempt to retrieve the name, it often fails on hard disks because the catalog is fragmented. It usually works on CDs and disk images, though.

3.2.4. The Apple Partitioning Scheme

Apple's partitioning scheme is quite pleasant since it is exclusively based on logical sector numbers. (This may have to do with Apple's early adoption of SCSI.) It seems to be fixed to a sector size of 512 bytes, even on CDs.

The partition map is stored using one sector per partition, starting at sector 1. Sector 0 is used for driver information. The partition map also contains an entry for itself, and entries for any free space between or after partitions. According to the spec, every sector of the disk must be accounted for in the map.

The type of the partition is stored as a clear text string, using such names as "Apple_HFS" or "Apple_Free" (for unused space). There is no distrinction betweeen HFS and HFS+ here; see the blurb about wrapped HFS+ volumes above.