12

I have a question that's probably not asked too often, because it has little negative impact on the user. I can't find it on The Google anyway.

So this question is for the edification of the curious-minded.

In my production environment I manually backup often. I have noticed that when simply duplicating files, they don't take up as much space as they used to in older versions of MacOSX.

As an experiment (because I am a nerd) I attempted to fill my hard drive by copying large files. Duplicating files barely changed the "capacity" / "available" numbers at all.

The duplicates are there.

Can someone explain this aspect of the OSX filing system to me? It's absolutely amazing!

Details:

  • not using Cloud
  • MacBook Air ca. 2017
  • MacOSX 10.14.6
4
  • 7
    Note that if you're duplicating files on the same volume, that's not a backup.
    – benwiggy
    Commented Mar 2, 2020 at 16:33
  • 1
    @benwiggy Understood. It's a backup in situ, not a proper backup to a secondary drive. I was calling it backup in terms of my own production system, not the Apple file system.
    – Parapluie
    Commented Mar 2, 2020 at 19:12
  • 4
    The concept you're looking for is copy-on-write. Commented Mar 2, 2020 at 22:58
  • Also it's just macOS now. Commented Mar 3, 2020 at 11:14

1 Answer 1

23

Apple File System (APFS) and Clones

Copying a file creates a clone of that file. Clones take very little space. Only when a clone is modified, is significant additional space required.

Clones

Clones allow the operating system to make efficient file copies on the same volume without occupying additional storage space. Changes to a cloned file are saved as delta extents, reducing storage space required for document revisions and copies.[9] There is, however, no interface to mark two copies of the same file as clones of the other, or for other types of data deduplication.

See also iMore's Apple File System (APFS): What you need to know.

To understand how APFS works, see the Apple File System Reference.

14
  • 1
    Very nice! I suspected that some kind of system was in play like the one in the "Delta extents" link. Thank you, Graham, for providing this information on Clones.
    – Parapluie
    Commented Mar 2, 2020 at 19:17
  • 2
    @AleksG This is exactly my concern with this hidden behavior. Duplicating files on the same file system is common for temporary backups. And how does one know the files are linked if you duplicate and rename? And how many deltas are needed before a whole new file is just made?
    – Logarr
    Commented Mar 3, 2020 at 15:43
  • 2
    @Logarr there is no Apple provided friendly interface to examine the underlying state of files on APFS. I would not expect any. The trend with Apple is towards more abstraction in the file system. Look at Apple's decision with how the Applications folder is handled in macOS 10.15. Commented Mar 3, 2020 at 16:33
  • 4
    @AleksG "I wonder how it works when you clone, then delete the original." Nothing interesting happens. The old reference to the data is destroyed, the new reference remains, and the underlying data is undisturbed.
    – Alexander
    Commented Mar 3, 2020 at 17:24
  • 2
    @Harper I'm familiar with links. I am also painfully aware of what happens when the link target gets corrupted. A typical macos user may not realise that they are not creating a full backup copy when in fact they are creating a link.
    – Aleks G
    Commented Mar 3, 2020 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .