How Disk First Aid Repaired Mac OS 9 Volumes
Disk First Aid was Apple's primary native utility for maintaining disk health in the classic Mac OS era, tasked with verifying and restoring the structural integrity of Hierarchical File System (HFS) and HFS Plus (Mac OS Extended) volumes. Operating through a multi-pass analysis, the utility systematically traversed core volume metadata structures—including the Volume Header, Catalog B-tree, and Extents Overflow B-tree—to identify discrepancies such as broken node links, invalid directory hierarchies, and misallocated blocks. Once anomalies were detected, Disk First Aid resolved them by re-linking corrupted tree nodes, correcting allocation counts, and resetting corrupted volume status flags to return the volume to a bootable, stable state.
The Target File System Architecture
To understand how Disk First Aid worked, one must understand the key structures it evaluated within Mac OS 9 volumes:
- The Master Directory Block (MDB) or Volume Header: Contains global volume settings, size attributes, creation dates, block allocation sizes, and pointers to the remaining metadata structures. It also houses the volume's "dirty bit," a flag indicating whether the disk was unmounted cleanly.
- The Allocation File (or Volume Bitmap in standard HFS): Tracks which allocation blocks on the physical drive are in use and which are free.
- The Catalog File: A balanced tree (B-tree) structure containing records for every file and folder, maintaining the nested folder hierarchy.
- The Extents Overflow File: A secondary B-tree that records extra allocation blocks (extents) assigned to files when they are too fragmented to be indexed within their initial Catalog record.
Phase 1: Structural Verification and Diagnosis
When a user initiated a scan, Disk First Aid unmounted or locked the target volume to ensure that no running system processes could write to the disk during evaluation. The utility then conducted a rigorous, stepped diagnostic routine:
- Volume Header and Block Consistency: The tool first read the Volume Header to ensure basic file system signatures were valid. It calculated total capacity against recorded allocation blocks to verify that the drive geometry reported by the disk driver matched the file system boundaries.
- Extents Overflow Tree Analysis: Disk First Aid validated the B-tree structure of the Extents Overflow file, checking that index nodes correctly pointed to leaf nodes and that key sorting orders remained uncorrupted.
- Catalog File Traversal: The utility performed a depth-first traversal of the entire Catalog B-tree. It verified parent-child directory relationships, confirmed that every folder possessed valid directory threads, and ensured that file and folder record counts accurately reflected the actual records encountered.
- Cross-Referencing Allocations: The tool matched file extent mappings against the Allocation Bitmap. This step detected overlapping extents (two separate files mistakenly claiming the same physical sectors) and "orphaned" blocks (sectors marked as active in the bitmap but not claimed by any cataloged file).
Phase 2: Algorithmic Repair Mechanisms
Once diagnostic passes revealed corruptions, Disk First Aid presented a repair prompt. Upon confirmation, it applied targeted, deterministic repairs directly to disk sectors:
- B-Tree Node Re-linking and Pruning: If leaf or index nodes in the Catalog or Extents trees were severed due to an improper shutdown or crash, Disk First Aid attempted to reconstruct the doubly linked list that connects sibling nodes. Corrupted, unreadable nodes were pruned, and the tree depth was re-indexed.
- Rebuilding Directory Hierarchy: If a folder thread record was damaged or missing, rendering child files invisible to the Finder, Disk First Aid generated substitute catalog records. It often moved disconnected items into a newly created folder named "Damaged Items" at the root level, rescuing files that were otherwise inaccessible.
- Recalculating Block Allocations: In cases where file sizes in the Catalog did not match the allocated extent blocks, or where free space counts were mismatched, the utility recalculated the correct values based on actual file extents and rewrote the Allocation Bitmap and Volume Header.
- Clearing the Clean Unmount Flag: If a crash caused a volume to mount in a read-only or unsafe state due to an unresolved "dirty bit," Disk First Aid flipped this indicator back to clean once all structural verifications passed.
Execution Boundaries
Because Disk First Aid ran in the single-user, cooperative multitasking environment of Mac OS 9, it had operational constraints. It could not repair the currently running startup volume if vital system files were open and active. Users were required to boot from an alternative media source, such as a Mac OS 9 Install CD or a secondary startup disk, allowing Disk First Aid exclusive, unhindered read/write access to repair the corrupted volume's structures safely.