Post #2076785
2026-04-30 21:14 UTC
Is there a way on #ZFS or #BTRFS to create a file that is the concatenation of two files?
So, cat a b > ab, but only taking up metadata?
Is the best way to just do the write and then ask the kernel to deduplicate it, and pray that it doesn't flush to disk in the meantime?
This would be really useful for serving smaller chunks of packages on #NixOS or #Guix, but also potentially on other distros as well, or even for general download optimization. (cc #bittorrent ?)
edit: Thanks, apparently there is an ioctl for this:
https://man7.org/linux/man-pages/man2/ioctl_ficlonerange.2.html
Replies (3)
-
@hambier@mastodon.opencloud.lu 2026-04-30 21:19
@csepp@merveilles.town I'm by no means an expert on this but wouldn't the ficlonerange ioctl suit your needs? https://man7.org/linux/man-pages/man2/ioctl_ficlonerange.2.html
-
@pauldoo@mastodon.scot 2026-04-30 21:43
@csepp@merveilles.town yes, with caveats. https://www.man7.org/linux/man-pages/man2/ioctl_ficlonerange.2.html
-
@zlatko@social.zlatko.dev 2026-05-01 05:30
@csepp@merveilles.town copy on write, but for concatenation of two files. Huh.