APFS in new disk

My disk is formatted as APFS
I have a 10GB file and I make 10 copies of that file
According to what APFS does, my disk will not be 100GB shorter on disk space, right? Only 10GB because of the original file.

So what happens if I get another disk, also APFS, and move all of those 11 files there, will macOS know that 1 file is the original and the other ones are cloned? Does that information get retained with the files or on the new disk I will have indeed 110GB of disk being used? If so, is there a way to prevent this?

I have just tested this and Finder knows the files were clones. It copies the file just once (showing just the file size of a single file during transfer) and uses the disk space on the external drive just once (but correctly showing the full size of the folder).

1 Like

does APFS do this automatically for anything I copy/paste?

Yes. If you duplicate the file on the same APFS volume, APFS will just clone the file and will not use any extra disk space as it has really not used any. You can easily see that this is taking place as duplicating a 10- or a 100GB file or folder (Cmd+D) in Finder is so quick that no progress bar is even shown. Have disk info open to see that you have not lost any free disk space. As you edit the duplicates, APFS starts using more disk space but just to store the changed blocks.


Thank you for testing.
So you duplicated files internally, then copied those files to an external drive and the space being used was just the original size, without the clones’ size combined?

Until you make some form of change to one of those copied files, then I’m unclear whether the whole file is different (e.g. taking up an extra 10GB of storage) or if only the disk blocks changed are referenced meaning a much smaller impact to the amount of spare space available.

Yes. Duplicated the files on internal storage totalling over 100 GB and then copied them to the external APFS-formatted drive. Total storage used on the external drive increased by the size of a single test file, but the folder size was correctly calculated as being 100-something GBs. The progress bar in Finder has shown that only around 13 GB (a single test file) was actually copied.

@geoffaire The article from Oakley above says that only the changed blocks are technically stored when editing the duplicates but that he has noticed that changed cloned files sometimes grow disproportionately to the changes made nevertheless (but I guess that might also depend on the file type, and the app used as well).

Overall APFS seems to be good in terms of using the storage space optimally but not particularly well documented (not a surprise, though) which makes it doubtful that we’ll ever see any utilities for more control over this behaviour (which is what OP asked in the other thread).

1 Like

This may depends on the block size used on the APFS volume (I’m leaning on potentially outdated knowledge here) but if the block size on the disk (the unit size in which data is stored) is 1 megabyte and you change one character in a word processing document, the change seen on the disk will be an increase of 1 Megabyte as the whole block which was changed from the original would need writing. Multiple changes in a document (depending on the document format) may span several blocks in the original requiring updated copies of all of the disk blocks to be stored.

This means in theory that change of a few kilobytes could lead to an increase of several megabytes. It’s easy to see why this could be the case.

Awesome! Thank you so much for taking the time to run this test and share the results! Good to know that this not “locked” to the current disk :muscle: