How Mac OS 9 Disk First Aid Verifies Disks

In Mac OS 9, Disk First Aid served as the primary native utility for diagnosing and repairing file system corruption on physical drives and mounted disk images. The tool operated by sequentially analyzing the fundamental data structures of the Hierarchical File System (HFS) and Mac OS Extended format (HFS+). Rather than scanning raw file payloads for data corruption, Disk First Aid focused on the volume's underlying metadata, traversing B-trees, verifying allocation maps, and confirming directory hierarchies to ensure the volume was structurally sound and safe for read/write operations.

Disk Image Handling

When verifying a disk image (such as .img or .smi files), Disk First Aid interacted with the image via the Mac OS 9 Disk Copy extension and the File Manager. Once mounted, the operating system presented the image to Disk First Aid as a standard virtual block device. The utility read the image's raw sectors just as it would a physical SCSI or ATA disk, examining the enclosed file system structures within the boundary of the image's partition map.

Volume Header and Master Directory Block Verification

The verification process began at the lowest logical level of the volume:

  • HFS Volumes: The utility inspected the Master Directory Block (MDB) located at logical block 2 of the volume, which contained global volume information, allocation block sizes, and pointers to internal system files.
  • HFS+ Volumes: Disk First Aid examined the Volume Header located 1024 bytes from the start of the volume.

The software verified critical volume attributes, such as whether the volume was marked as cleanly unmounted, whether the allocation block size was a valid power of two, and whether internal volume size calculations aligned with the actual physical sector count provided by the disk driver.

Extents Overflow B-Tree Inspection

Disk First Aid next validated the Extents Overflow File, which tracked non-contiguous storage allocations (extents) for files that exceeded their initial contiguous block allocations. The utility traversed this B-tree to ensure:

  • All index and leaf nodes were correctly ordered and structurally intact.
  • Block allocation records did not point to locations outside the volume boundaries.
  • Extent records correctly mapped back to valid file IDs, ensuring no orphaned file fragments existed.

Catalog B-Tree Analysis

The Catalog B-Tree is the central directory of an HFS or HFS+ volume, storing metadata for every file and folder. Disk First Aid performed a deep structural traversal of this tree to ensure consistency:

  1. Node Auditing: It validated node descriptors, record offsets, and keys to ensure search trees were properly balanced and sorted.
  2. Hierarchy Validation: The tool verified "thread records" (pointers linking a child back to its parent directory) against directory records, confirming that the folder hierarchy was intact without circular references or inaccessible nodes.
  3. Record Count Cross-Checking: The total number of observed files and folders was compared directly against the aggregate counters stored in the Volume Header or MDB.

Allocation Map and Bitmap Auditing

To identify conflicting storage claims, Disk First Aid audited the volume's allocation records:

  • On HFS, it scanned the Volume Bitmap; on HFS+, it inspected the Allocation File.
  • The tool built an internal map of all blocks marked as used by walking through the Catalog and Extents Overflow files.
  • It compared this reconstructed map against the volume’s existing bitmap to detect missing blocks, unreserved system areas, or overlapping allocations (cross-linked files), where two distinct files erroneously claimed ownership of the same storage blocks.