Fast copies with Solaris 11.4
Oracle 11.4 got two new functions called reflink
and reflinkat
. It’s seems to be a rather small change, but it has quite some importance. The man page explains:
This creates a copy of the file without actually reading and writing it. However both files are independent afterwards. You can write into a file without changing this copy. So it’s not just a symbolic link or something like that. Think of it like a ZFS snapshot, just file level. Important to know: It only works this way when both files are in the same ZFS pool.
Okay, how do you use this function? Well, you don’t have to write your own application, easiest way is to use cp -z
. At first i try a normal copy. It’s the second run.
Now we add the -z
option.
What .. it takes longer? Fast copy? Well, this command does a lot in the background in order to enable future speedups. Because when you try it a second time, the number looks differently.
Significantly faster. So … where you can use this feature. It’s not for copying a file a single time, as the first copy is slower. However if you copy large VMs contained in your deployment process quite often , this is an extremely fast way to clone you environments, saving disk space and compute/io resources on the way. Another example would be coping large database files for example to create developer environments.
Do you want to learn more?
docs.oracle.com - reflink (3c)