I am struggling to understand exactly what the rsync
options --update
and --append-verify
do.
Doing info rsync
gives
-u, --updateThis forces rsync to skip any files which exist on the destina‐tion and have a modified time that is newer than the sourcefile. (If an existing destination file has a modification timeequal to the source file’s, it will be updated if the sizes aredifferent.)--append-verifyThis works just like the --append option, but the existing dataon the receiving side is included in the full-file checksumverification step, which will cause a file to be resent if thefinal verification step fails (rsync uses a normal, non-append‐ing --inplace transfer for the resend).
I am using rsync
to transfer directories recursively. There are times whereI have to stop the rsync
transfer, and resume the transfer a few hours or days later, without affecting the already transferred files at destination.
I also got some files that return errors by rsync, such as
rsync: read errors mapping "/media/hc1/a1-chaos/amvib/IACL-2017-07-19T00:00:00-2017-07-19T23:59:59.mseed": Input/output error (5)
I would like to retry the transfer of these files, at a later time too, without affecting the files that had been transferred successfully.
Best Answer
Considering this question hasn't been answered before I thought I'd give it a go. Tried commenting it instead of answering but I have to get 50 rep to do that.
From what I've read from the man page of rsync/your info command and from what I've read from this question. Rsync will always overwrite everything except if the file has the same time and size.
Giving it the -u, --update option will stop rsync from replacing files that has a newer modification timestamp on the target, though it will still replace the target file if the file has the same modification time but different size like its stated.
(If an existing destination file has a modification timeequal to the source file’s, it will be updated if the sizes aredifferent.)
The --append option will append any extra data from the source to the target. But, if the target has a same size or bigger than the source it will skip it. So, it will only add the extra stuff if the source is bigger.
The --append-verify is essentially the --append option but with an extra stuff on top. It does checks on both the source and target files. If it is different, it will resend the whole file and not append it.
Therefore, its different. You can even use --append-verify and --update option together. I believe it will append the file that has an older timestamp on the target and that the source file is bigger than the target and If the target & source modification timestamps are the same, it will only append it if the source size is bigger. Of course, for any files that it go through and not skipped, if the files are different it will resend it.
To answer your question, I believe --append-verify is what you're looking for if you want to continue the transfer at a later time. Do note, it will not try to append any files if the source has the same size or smaller. So, if you delete some stuff on the source file and would like to make changes to the target file --append-verify will skip it.
If you'd like to sync it I believe
rsync --checksum <source> <target>
should do the trick.
As for the error message, I think its unrelated to the options discussed above. There is another question which is related to that error though.