I use the following option to synchronize to a btrs remote server.

rsync -aRrzu --inplace --delete -vv --files-from XXX

When the rsync fail (Ctr+C, very long network outage, ...) file that being transferred has its modification time set to the current time on the remote server and not the source modification time. Modification time is correctly set for files which transfer succeed.

As a consequence, as I am using --inplace (which implies --partial), the incomplete remote file is not deleted and appears to be newer than the source. So that re-running rsync does not synchronize this incomplete file.

Is there any way to enforce mtime to be set before transferring files ? --checksum may solve the issue, but has I deal with very large file (20GB), I would like to avoid this.

  • 1
    Welcome to this site! Maybe take a look at the option --size-only as mentioned in this question serverfault.com/questions/344731/… – Mr Shunz Sep 6 '18 at 11:11
  • From man : -t, --times preserve modification times – msp9011 Sep 6 '18 at 11:12
  • 2
    @SivaPrasath thank you, but the --times switch is implied by the -a which I use – vera Sep 6 '18 at 11:23
  • @MrShunz good workaround to the use of the --checksum option. But it may cause issue with --inplace when file is being modified such that size has not changed before the failure. – vera Sep 6 '18 at 11:28
  • Well, that's true, so probably a two pass rsync would do, first with --size-only to resume updating those partial files, then a normal pass to update the remaining files based on timestamps. – Mr Shunz Sep 6 '18 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.