This project provides Go APIs for making and checking APFS clones, as well as a CLI tool. Supports recursively cloning directories.
Credit to https://github.com/dyorgio/apfs-clone-checker for the checking method.
See reference.
To install,
go install tcl.sh/apfsclone/cmd/apfsclone@latestUsage:
apfsclone <source> <destination>
apfsclone -c [-q] <file1> <file2>
Makes or checks APFS clones.
---
In clone mode, if <source> is a file, make an APFS clone of it at <destination>.
If <source> is a directory, recursively clone contents of it at <destination>.
<source> and <destination> must be on the same APFS volume, and <destination>
must not exist. If <source> is a symbolic link, it is cloned as is, not followed.
The exit code is 0 if the clone operation is successful, and 1 otherwise.
---
In check mode (-c), check if <file1> and <file2> are APFS clones of each other.
Symbolic links are not followed. The following results may be printed:
result unknown (only when there's an error; printed in addition to the error)
files are apfs clones
files aren't apfs clones
files reference the same inode
both files are empty
The exit code is 0 if "files are apfs clones", 2 if "result unknown" (errored),
and 1 otherwise. With -q, message is suppressed, exit code is the same.
---
Options:
-c check mode
-q quiet