reflink utils

Dick Marinus <[email protected]> Sat, 01 Nov 2025 09:58:00 +0100
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Hi,

I've created some tools to work with reflinks (FICLONERANGE) which I'd
like to include in the util-linux project.

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.

First tool is blkdiff which takes two files, a base file and a new file. 
Then it creates both a delta file and an index, the delta file contains
the different blocks in new file compared to the base file and an index
file which contains the block indexes in either the base file or the
delta file so the new file can be constructed from that.

This is a bit similar to rdiff from librsync but uses fixed block sizes
and doesn't require the chunks to be in the same order. FICLONERANGE
only allows you to clone blocks of the filesystems block size.

The next tool is blkpatch which uses the base, index and delta file to
construct new file using reflinks.

I've also created blkcat which concatenates the blocks from all supplied
files using reflinks into a single file with the idea to use this as a
basefile to deduplicate files on a filesystem.

I think reflinks, or at least FICLONERANGE is linux specific so
util-linux would be a good fit. Reflinks are currently supported (AFAIK)
for BtrFS and XFS.

I'd love to know:

- can/should I contribute these to util-linux?
- are blkdiff, blkpatch and blkcat good names?
- what's required more? I can image I need to add some man pages etc.

I already found the Documentation/howto-contribute.txt which I would
use to contribute these utilities. GPL-2 is fine with me.

Kind Regards,
Dick