Checking if two files share extents
Hello,
I'm writing a simple custom deduplication script, and faced a problem with how to make it skip already deduped files. E.g., if I do
cp -a --reflink fileA fileB
...after this, how to check if fileA and fileB refer to the same extents on disk? I tried comparing the outputs of "filefrag -e", but this doesn't seem to be very reliable (and e.g. instantly after such copying and until some time later, the extent maps WILL differ).
The script I'm writing is in a scripting language, so ideally this should be obtainable via some command-line text based tool, without kernel API calls or the like.
Perhaps ideally something that would print a list of a given file's extents with their absolute block numbers. Looked at what's available in "btrfs inspect", but there doesn't seem to be any command of that sort.
Signature · 2 lines
With respect, Roman