Mac – How does Time Machine restore backups from APFS volumes

apfsbackuprestoretime-machine

Is Time Machine aware of any of the new APFS features, e.g. sparse files, file cloning etc.? As the Time Machine volume itself is still an HFS plus volume, I would expect some difficulties in mapping these concepts to the older file system.

I'm asking because I use some of these extensively (e.g. file cloning for organising my photo library and sparse files for Docker), to the point where they would not fit onto a volume when restored as regular files.

I have done some tests with zero-copied files, and it seems that at least these seem to be represented as hard links in the Time Machine backup volume, but I wonder if they are also restored as such (which would actually break some use cases, as COW space sharing and hard links behave differently when writing to the files).

In other words:

  • Does Time Machine restore sparse files as such, or are the restored files non-sparse?
  • Does Time Machine restore cloned files (created e.g. using the finder or cp -c) as such? Or are they restored as regular duplicate files (or, potentially worse, as a single file with multiple hard links)? If so, is there a difference when only part of the file is shared, versus all blocks?

Best Answer

Time Machine at the moment of writing doesn't support APFS for the backup destination (see this), while it can backup FROM an APFS or HFS+ volume. That's because the AFPS filesystem doesn't support directory hardlinks, which Time Machine heavily relies on.

Probably Time Machine needs to be rewritten to take advantage of the features you mentioned, which is something that can happen in future versions of macOS.