I have nested folders with a bunch of files inside that are hardlinked to each other. I would like to break the hardlinks (convert them into separate files), but then immediately convert each pair into a reflink (so they have different inodes but use the same section of disk).
find -type f -links +1
will find all the hardlinks, while a command like
cp --reflink=always my_file.bin my_file_copy.bin
will copy a file without using any more disk space, creating it as a reflink.
How do I combine these to go through a whole set of nested folders and convert each hardlink into a reflink, replacing them with the same filename?