Re: reflink utils
Masatake YAMATO <[email protected]> Mon, 03 Nov 2025 22:55:08 +0900 (JST)
| Newsgroups | org.kernel.vger.util-linux |
|---|---|
| Organization | Red Hat Japan, K.K. |
| Message-ID | <[email protected]> |
Hi, > 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 have contributed to the util-linux project on multiple occasions. I hope my commit https://github.com/util-linux/util-linux/pull/2627/commits/0d5f67b29ce487e9cfff7c8b16aa8f9e7c0e2d10 helps you. This may be one of the smallet commit that added a new command to util-linux. See also the commits added after the commit: https://github.com/util-linux/util-linux/pulls?q=is%3Apr+is%3Aclosed+exch They fixed my mistakes. Masatake YAMATO