Thursday, March 7, 2019

How Time Machine Makes Backups With APFS

Howard Oakley:

The preparatory sequence identifies and deletes expired local snapshots. According to Apple’s Support Note, these local snapshots are kept for 24 hours; although the log entries below indicate a shorter period, later backups confirm that this is normally the case, and you should expect to find a full 24 hours of snapshots at any time.

backupd then copies changed items to the backup destination. In order to maintain the impression that each backup is a complete copy of the source volume, it then makes hard links to all the unchanged files and folders. It is able to do this as, unlike many file systems, HFS+ supports directory hard links as well as those to files.

[…]

backupd then checks that there is sufficient free space on the backup destination, and if there is, performs that same process as with HFS+, copying changed items and making hard links to the rest. That is followed by new steps, which save a clone family cache to the new backup folder, and back-up-later caches there too. The precise purpose of these isn’t yet clear, although the latter may well list files which changed as the backup was being made.

[…]

I have been writing that Time Machine has fallen behind macOS, at least in respect of its reliance on the HFS+ file system for backups, which results from its use of directory hard links. This implementation of Time Machine for APFS is perhaps best viewed as version 1.5: it now takes best advantage of the new file system as its source, but has yet to find a new backup method and format appropriate to an APFS backup destination.

Howard Oakley:

That old [HFS+] system periodically failed, perhaps when FSEvents lost track of recent changes, or became corrupted. In those circumstances, Time Machine would perform a lengthy ‘deep traversal scan’ to determine what needed to be backed up, which could in some cases take several hours. One strong case for adopting a new approach with APFS was to reduce the frequency of those deep traversals by using a more robust mechanism for determining what to back up. There’s no evidence that the new snapshot-based system is any quicker – indeed, in many cases it may perform more slowly than using FSEvents.

[…]

However, deep traversal scans do still occur on APFS volumes. In one period of only 8 hours, my iMac Pro undertook and completed two such scans, as shown in the T2M2 report below.

Previously:

2 Comments RSS · Twitter


I really wanted time machine to work, but it was just too unreliable. Switched to an rsync solution and it has worked seamlessly for months.


Leave a Comment