Deep Dive: What Happens During Time Machine’s “Preparing/Finishing Backup” Phases – Technical Breakdown for macOS Developers


1 views

When Time Machine displays "Preparing backup..." or "Finishing backup...", several technical operations occur beneath the surface that aren't immediately obvious to users. These phases involve complex filesystem operations that sometimes appear disproportionate to the actual data changes.

The "Preparing" phase performs these critical tasks:

  • Cataloging the entire filesystem hierarchy using FSEvents API
  • Comparing inode metadata with the last backup snapshot
  • Building a delta map of changed blocks (even for large files)
  • Establishing hardlink structures for unchanged files

Here's how you can monitor these activities programmatically:

# Terminal command to watch backup preparation
log stream --predicate 'subsystem == "com.apple.TimeMachine"' --info

# Output example:
2023-07-15 10:23:45.123456-0700 TimeMachine[123] (Preparation): 
Scanning 1,243,792 files (4.2TB) with 18,432 changed inodes

The apparent delay often stems from HFS+/APFS metadata operations rather than actual data transfer. Each backup triggers:

  • Journal replay verification
  • Snapshot creation (on APFS volumes)
  • Directory hardlink reconstruction
  • Extended attribute consistency checks

When using Time Capsule, additional factors come into play:

# Check network-related Time Machine operations
tmutil associatedisk -a / /Volumes/Backup

# Common network-related delays include:
# 1. SMB protocol negotiation (especially with newer macOS versions)
# 2. Spotlight indexing of remote volumes
# 3. DNS reverse lookup timeouts

For developers experiencing extended preparation times:

  1. Prune unnecessary files from backup:
  2. tmutil addexclusion /path/to/large/directory
  3. Force local snapshots first:
  4. tmutil localsnapshot
  5. Disable spotlight indexing on backup volume:
  6. mdutil -i off /Volumes/Backup

The finishing phase typically involves:

# View detailed finishing operations
sudo fs_usage -w -f filesys backupd

# Common operations seen:
# 1. F_NOCACHE operations (buffer flushing)
# 2. CS_VALIDATE (code signature verification)
# 3. WRITE_PACKET (network transmission finalization)

For persistent cases, consider rebuilding the backup history:

tmutil thinlocalsnapshots / 9999999999999999 1

When Time Machine shows "Preparing backup..." it's performing several critical operations that aren't always obvious:

// Pseudocode of Time Machine's preparation phase
void prepareBackup() {
    catalogCurrentState();       // Builds snapshot of current filesystem
    compareWithLastBackup();     // Performs checksum comparisons
    handleSpotlightReindexing(); // Deals with metadata changes
    verifyBackupDestination();   // Checks Time Capsule connectivity
    createTemporaryDatabase();   // Sets up tracking for this session
}

Several non-intuitive factors affect the preparation phase duration:

  • Metadata operations (inodes, permissions, extended attributes) require full filesystem traversal
  • Network latency with Time Capsule during initial handshake
  • System resource contention (CPU/memory pressure from other processes)
  • APFS snapshot creation overhead on SSDs

During the "Finishing backup..." stage, Time Machine is:

// Key operations during completion phase
completeBackup() {
    finalizeDatabaseTransactions(); // Atomic commit of changes
    updateBackupCatalog();          // Global backup index
    purgeTemporaryFiles();          // Clean up working space
    verifyBackupIntegrity();        // Checksum validation
    updateLocalSnapshots();         // For local Time Machine backups
}

For developers experiencing unusually long delays:

  1. Exclude build directories:
    defaults write com.apple.TimeMachine SkipPaths -array-add "/Users/username/Library/Developer"
  2. Schedule backups during low activity:
    sudo tmutil schedule
  3. Clear Spotlight index:
    sudo mdutil -E /

To inspect Time Machine's operations in real-time:

# Monitor Time Machine processes
sudo fs_usage -f filesys backupd

# Check backup log
log show --predicate 'subsystem == "com.apple.TimeMachine"' --info

# Verify backup integrity
tmutil verifychecksums /Volumes/Backup/Backups.backupdb