Long ago, I had to restore a Borg backup of a filesystem with heavily-deduplicated content -- which, without that deduplication, wouldn't come even close to fitting on the target drive.
To fix this problem, I threw together some scripts to use reflinks to deduplicate restored content -- more quickly than running bees
could do it.
(This was a NixOS system, so many files live in a read-only, world-readable store under /nix/store
; added some logic to hardlink those together when entire files precisely match instead of using reflinks at all; pull it if not comfortable doing that).
This is what I still have of them. YMMV.