shellfilesystemsmacos-high-sierraapfs

Apple File System (APFS) Check if file is a clone on Terminal (shell)


With macOS High Sierra a new file system is available: APFS.

This file system supports clone operations for files: No data duplication on storage.

cp command has a flag (-c) that enables cloning in Terminal (shell).

But I didn't find a way to identify theses cloned files after.

Somebody knows how to identify cloned files with a shell command, or a flag in a existent command, like ls?


Solution

  • After 3 years and 2 months... I received a lot of points because of this question here on stackoverflow.

    So yesterday I decided to revisit this topic :).

    Using fcntl and F_LOG2PHYS is possible to check if files are using same physical blocks or not.

    So I made an utility using this idea and put it on github (https://github.com/dyorgio/apfs-clone-checker).

    It is only the first release guys, but I hope that the community can improve it.

    Now maybe a good tool to remove duplicated files using clone APFS feature can be born. >:)