Barak Amar
cp -c
. In case copy-on-write is required, not like symbolic link where modification will effect the source, data is kept and new one will be created if we try to update.
Example of how to use and the time of copy/clone:
create large file
$ dd bs=1024 count=10485760 </dev/urandom > data
copy the file
time cp data data-cp
cp data data-cp 0.01s user 4.17s system 79% cpu 5.269 total
clone the file
time cp -c data data-clone
cp -c data data-clone 0.00s user 0.00s system 70% cpu 0.004 total
Ariel Shaqed (Scolnicov)
06/17/2021, 2:23 PMcp --reflink=auto
(which has the advantage of not failing if the FS doesn't support it) or --reflink=always
to fail fast.Barak Amar