Why is cp --reflink=auto not the default behaviour?
It's not the default since for robustness reasons one may want a copy to take place to protect against data corruption. Also for performance reasons you may want the writes to happen at copy time rather than some latency sensitive process working on a CoW file and being delayed by the writes possibly to a different part of a mechanical disk. Note that from coreutils v8.24 mv will reflink by default, since it doesn't have the above constraints. Note also that the major release after v8.32 will try to reflink in cp by default, as such a change is not appropriate for a minor release.
Don't know why it's not the default, maybe so that it behaves the same as other copying utilities (rsync
, cpio
, pax
, tar
...) which have no support for it (or when files are copied across an interface that doesn't allow that (like NFS, samba, fuse file systems layers...).
I was in the same situation a few years ago, and looking at GNU cp code quickly, it's still the same, you have to patch the code to get a different default behavior:
--- coreutils-8.21/src/cp.c~ 2013-06-22 21:50:26.265639114 +0100
+++ coreutils-8.21/src/cp.c 2013-06-22 21:51:06.880513924 +0100
@@ -775,7 +775,7 @@ cp_option_init (struct cp_options *x)
x->interactive = I_UNSPECIFIED;
x->move_mode = false;
x->one_file_system = false;
- x->reflink_mode = REFLINK_NEVER;
+ x->reflink_mode = REFLINK_AUTO;
x->preserve_ownership = false;
x->preserve_links = false;
alias cp='cp --reflink=auto --sparse=always'
makes better sense than patching the code