The Samba-Bugzilla – Bug 12030
rsync leaves temporary files when transfer is interrupted.
Last modified: 2016-07-30 22:07:21 UTC
When the transfer 'rsync -a dir remote:.' is interrupted and then reran, it leaves the temporary files with a period as a prefix and suffixes like this: .T5umN0
It will be great if rsync first cleaned up the previously left temp files that have the same name pattern.
By default rsync does delete the incomplete file when it is aborted. The override for that is --partial (which is implied by -P).
However, it also depends on how the rsync is interrupted. If it crashed or was killed then it wouldn't have the opportunity to clean up. If network connectivity was lost then it is possible that the sshd and rsync are actually still running waiting to receive the rest of that file.
The intelligent way to handle this is to verify the leftover temporary file content with partial checksums and reuse it if the content is the same as an incoming file.
If you use --partial or --inplace and you don't use --whole-file that is exactly what it will do.