Shared blocks
Two files on the same filesystem holding the same storage until one of them is written to.
Two files on the same filesystem holding the same storage until one of them is written to.
The system call has several names. macOS calls it clonefile and exposes it as
cp -c. Linux calls it a reflink and exposes it as cp --reflink. btrfs, XFS
formatted with reflink=1, OpenZFS 2.2 and bcachefs all implement it. ext4 and
tmpfs have no way to share blocks between two files.
gitto measures rather than asking the filesystem its name, because cp -c on
a filesystem without the call succeeds by making a full copy and reports
success either way. See Measuring the filesystem.