Duplicate files
Two identical files take twice the space. Coldpack finds them and turns each extra copy into an APFS clone of one source file. Both files keep their names and folders, both still open as before, and the copy uses no extra space until one of them changes.
What a clone is
A clone is a file that shares its blocks on disk with another file. It is not a link: a change to one file never reaches the other, because APFS writes the changed blocks apart. Deleting the source leaves the clone intact. The replaced copy keeps its name, folder, permissions, tags, extended attributes and dates.
Which file stays the source
- Cloud folders first. A file in a source folder is always the source and is never replaced, so sync clients and backups see no change. The defaults are iCloud Drive (
~/Library/Mobile Documents),~/Library/CloudStorageand/Volumes/GoogleDrive. You can edit the list. - Otherwise the oldest file (by creation date) is the source.
- When every copy is in a source folder, the group is left alone.
Modes
Choose in Settings, Duplicates:
- Off: Coldpack does not look for duplicates.
- Suggest (the default): Coldpack lists the groups in the Duplicate Files window. Nothing changes until you choose Replace with Clones….
- Automatic: Coldpack replaces each copy once a day. With dry run on, it only lists them.
How identical is proven
First the size must match. Then Coldpack compares a SHA-256 hash of the first and the last 64 KB, then a SHA-256 hash of the whole file. Right before a replace it compares the two files byte by byte. Any difference, or any change during the work, stops the replace and keeps the copy as it is. The work is journaled: after a crash or a power loss, the next start finishes or undoes it.
What is never replaced
Files in source folders, files below the minimum size (1 MB by default), copies changed in the last 7 days, hard links, files that belong to another user, executables and files inside apps, files open in another app, files that already share their blocks with the source, files that have a resource fork, and files that a skip rule covers. Each copy is checked again right before the replace.
How Coldpack finds them without reading your whole disk
Coldpack reads the Spotlight index for the large files Spotlight knows. For the folders Spotlight skips, it keeps a small file map: one row per large file with its device, inode and size, and no file names. File events keep the map current, so a new copy is found at the next daily check without a new walk. A slow walk, paused while the Mac is busy, refreshes the map every 30 days by default. Only files that share a size with another file are ever read, and their hashes are kept so they are not read again.
coldpack dups --top 10
coldpack dups --refresh --apply
--refresh checks again, --rescan walks the folders again first, and --apply replaces every listed copy.
App Store edition
The sandboxed edition sees only the folders you grant. It cannot read the Spotlight index, so the file map covers those folders, and it sees a cloud folder only when you grant it.