On 13/01/2026 08:25, Dick Marinus wrote:
Hello,
I've created some tools to work with reflinks (FICLONERANGE) /
copy_file_range(2).
Reflinks can be used to share equal blocks between files. Cloning a
block using reflinks will not copy any data saving I/O and disk wear/
space.
I use these tools to construct new files from blocks in existing files,
The only tool that comes close to copying file ranges is dd but I
don't think it allows you to specify multiple file ranges per
execution.
You can do multiple operations with dd using this pattern:
$ (dd operation=1; dd operation=2) < input > output
Currently I've proposed to get copyfilerange added to util-linux:
https://github.com/util-linux/util-linux/pull/3947
https://github.com/util-linux/util-linux/compare/master...meeuw:util-linux:copyfilerange.patch
Would coreutils be a better fit for such a tool or can an existing tool
be extended to share equal blocks between files?
greetings,
Dick Marinus
util-linux seems like a better place for a low level tool like this.
I would see it in a similar space to the existing fallocate(1) tool in
util-linux.
thanks,
Padraig