I want to make a behaviour like btrfs send and btrfs receive, but on a per-file basis.
As far as I see it, I can use cp -ax --reflink=always to make a "snapshot" of the file.
Let's assume that two such "snapshots" on two different hard disks are exactly equal.
How do I cp the diff (and only the diff) between two reflinked files like btrfs send -p would do it?
Ideally, I would like to have a solution that works on any filesystem that is capable of making reflinks and not only on btrfs. Also ideally, I would like to run it without sudo.
I know that I can look at the file extents with filefrag, but filefrag does not guarantee that the results are exact. I would rather copy some megabytes more than taking the risk of a corrupted file.