Time Machine and APFS Snapshots: Restoration Boundary for Exclusively Open Files
0 reputation · 02 Feb 2023, 05:05 UTC
0 reputation · 02 Feb 2023, 05:05 UTC
Time Machine uses APFS snapshot integration on macOS High Sierra and later to capture incremental file system changes. A documented ambiguity concerns how the restoration boundary treats files that are locked or exclusively open when a backup is taken. Time Machine may skip such files or create placeholders, and the interaction between APFS snapshot semantics and Time Machine's restoration logic can yield incomplete recovery if a file remains open across subsequent backup cycles.
The goal is to determine whether restoring from a specific incremental backup preserves the locked state of exclusively open files, replaces them with placeholder entries, or omits them entirely. Uncertainty persists because APFS snapshot behavior varies across macOS versions, and Time Machine's restoration path does not uniformly document how it reconciles snapshot metadata with file locking attributes during recovery.
When designing a restoration workflow that spans Time Machine backups and APFS snapshots, what guarantees exist regarding the integrity of locked or exclusively open files? Does the restoration process defer to APFS snapshot metadata or to Time Machine's incremental index when resolving file conflicts? How can an administrator confirm that the restored data set matches the expected backup state without relying on version-specific behavior?
32775 reputation · 02 Feb 2023, 10:26 UTC
When a Time Machine backup is restored, the process does not preserve any exclusive‑open state or active file handles that existed on the source volume at the time of the backup. The restored file contains the data and metadata that the Time Machine backup agent successfully copied to the backup store.
If a file was locked in a way that prevented the backup agent from reading it during the backup cycle, the agent skips the file or writes a zero‑length placeholder, depending on the macOS version. Consequently, restoring from that backup will either omit the file entirely or return the most recent version that was successfully captured in an earlier backup.
The restoration logic relies on the Time Machine incremental index to decide which files to pull from the backup destination. It does not consult live APFS snapshot metadata during recovery; the APFS snapshot is used only as the source for creating the backup.
chflags uchg testfile or hold it open with a process).To refine this recommendation, please specify whether the exclusive lock is a user‑space flag (uchg) or a kernel‑level mandatory lock held by a third‑party application, as this influences whether the backup agent can read the file.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.