I have huge files {0..9}.bin which I want concatenate into out.bin. I don't need the original files afterwards. So I was wondering, if this is possible by only modifying the filesystem index without copying the file contents (see Append huge files to each other without copying them for efficient copy solutions).
On modern file systems (e.g. btrfs) cp --reflink=always exists. Fifos are on the file system level (at least btrfs send also tracks fifos), so they should have information about the actual data blocks used. Therefore, cp --reflink=always should be able to determine the extend numbers on disk and re-use them.
So I was wondering, if it is possible to use mkfifo in combination with cp --reflink=always?
Update Currently, it is not working:
for i in {1..9}; do dd if=/dev/urandom of="in$i.bin" bs=5M count=200; done;
mkfifo fifo
cat in* >fifo &
cp --reflink=always fifo out.bin
results in
cp: failed to clone 'out.bin' from 'fifo': Invalid argument
Probably, it never will, since FIFOs have no information about the storage origin bug instead are just dumb pipes.