APFS supposedly
features cloning for files and directories
I would like to figure out how this works, but I can't find a way to use this feature.
The only man page which seems vaguely relevant is clonefile(2)
, which says:
If src names a directory, the directory hierarchy is cloned as if each item was cloned individually. However, the use of
copyfile(3)
is more appropriate for copying large directory hierarchies instead ofclonefile(2)
But when you check the man page for copyfile(3)
, it says:
Note also that there is no support for cloning directories: if a directory is provided as the source, an error will be returned. (This is only applicable for the
copyfile()
function.)
This is further clarified further down the page:
Because
copyfile()
does not allow the cloning of directories, a recursive clone will instead copy any directory it finds (while cloning its contents).
Nonetheless, a few blog posts on the subject seem to imply that Finder can perform this operation using option + mouse drag, but when I test it here, it seems identical to a recursive copy, and isn't even cloning the contained files, let alone the directory.
So what's the deal here? Is the feature implemented at all? If it is, how do I get it to work? Or is it something they implemented in the on-disk format but never hooked into any APIs or tools?