rsync fails if it cannot stat destination file

Wayne Davison wayned at samba.org
Tue May 23 16:31:02 GMT 2006


On Wed, May 17, 2006 at 05:03:15PM -0700, Ferguson, Eric wrote:
> rsync --whole-file --temp-dir /tmp file.txt destination.machine:/path/to/file/file.txt
> 
> error:
> 
> rsync: stat "/path/to/file/file.txt" failed: No such file or directory (2)
> rsync error: some files could not be transferred (code 23) at main.c(702)

This is caused by the use of a temp-dir on a different filesystem than
the destination file.  In this case, rsync tries to rename the finished
file into place, but if it cannot, it copies it into place and then must
finish updating the permissions, ownership, etc. after the copy.  If the
file vanishes during this updating, rsync will complain about it.

The easiest fix is to change your temp dir to be on the same filesystem
as the destination dir, e.g. --temp-dir=../tmp (create that if it does
not yet exist).

If you must use a temp-dir on a different drive (typically for I/O
reasons, which wouldn't be the case when using --whole-file), there is
another way to tell rsync that you want the file to be renamed into its
final destination rather than copied into place:  if you use a relative
partial-dir option, rsync will first copy the file from the temp-dir
into the partial-dir, and then rename it into place.  For instance:

rsync --temp-dir=/tmp --partial-dir=../tmp file.txt dest:/path/

..wayne..


More information about the rsync mailing list