Details of local copy

jw schultz jw at pegasys.ws
Sat Jun 21 05:46:30 EST 2003


On Fri, Jun 20, 2003 at 12:34:17PM -0400, Ronald J Kimball wrote:
> I see in the manpage that if rsync is used to copy files locally, "it
> behaves like an improved copy command".  I was hoping for more details on
> what that means.

It doesn't copy files that don't appear to have changed.
I've used cpio instead of cp myself to take advantage of
such improvements.  rsync also will, if instructed, delete
files from the destination that don't exist on the source
location.

> Here's the specific situation I'm wondering about.  I have some files that
> are stored in two different locations on the same server.  I could rsync
> the files from the remote server twice, first to one location and then to
> the other.  Or, I could rsync the files once to one location, and then copy
> them to the other location.  (The first solution is simpler, but probably
> less efficient.)

Not necessarily.  Efficiency in what terms?  Copying, or
rsyncing, within the same machine can be slower than over
the network.  If the reads and writes of the local copy
contend for the same resources such as disk interfaces the
local copy can be slower than a fast network.

If you are copying between two locations on the same
physical disk you will cause a seek storm reducing the
performance of the disk dramatically.  A 100Mb network will
usually outperform a local same-disk copy.  If that is the
case and you are using rsync you may want to use
--whole-file.

Whether --whole-file improves performance on rsync with
100Mb networks will depend on the actual speed of the disk
subsystem and size of each file because temp files in the
same directory will be much less inclined to cause seeks.

> If I use rsync locally to copy the files from one location to another, and
> the files already exist in the second location, does rsync still compare
> the existing files to determine whether it needs to update the destination
> file, and does it still copy to a temporary file before replacing the
> destination file?

No.  For local transfers --whole-file is automatically
engaged by default.  If a file is to be copied, as
determined by comparing mtime and size, the whole file will
be copied.  It does still use the temp file but that way you
never have a partially updated file.


-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt



More information about the rsync mailing list