I think CoW works for this.
echo 'stackoverflow' > foo
cp --reflink foo bar
So what about this one?
echo 'stackoverflow' > foo
echo 'stackoverflow' > bar
In this case, do they use the disk space of two files?
In my use case, there are not many copied files on my disk. However, there are many files of the same content generated by programs.
I hope that CoW is effective for such files, but if not, isn't compression more effective? This is why I asked this question.