22

In Ubuntu, I want to copy a big file from my harddrive to a removable drive by rsync. For some reason or other, the operation cannot complete in a single run. So I am trying to figure out how to use rsync to resume file copying from where it was left last time.

I have tried to use the option --partial or --inplace, but together with --progress, I found rsync with --partial or --inplace actually starts from the beginning instead of from what was left last time. Mannually early stopping rsync and checking the size of the received file also confirm what I found.

But with --append, rsync starts from what was left last time.

I am confused as I saw on the manpage --partial, --inplace or --append seem to relate to resuming copying from what was left last time. Can someone explain the difference? Why --partial or --inplace do not work for resuming a copy? Is it true that for resuming a copy, rsync has to work with option --append?

Also if a partial file was left by mv or cp not by rsync, will rsync --append correctly?

Thanks and regards!

  • My understanding of how rsync works is limited, but to answer you last question. If a cp is incomplete, rsync should resume the copy. I believe rsync hashs files in a way that would find the beginning part of the file the same, and copy the remaining part of the file. – Scott McClenning Sep 26 '10 at 19:16
25

Looking at some pages for rsync:

--append
This causes rsync to update a file by appending data onto the end of the file, which presumes that the data that already exists on the receiving side is identical with the start of the file on the sending side.

--inplace
This option changes how rsync transfers a file when its data needs to be updated: instead of the default method of creating a new copy of the file and moving it into place when it is com- plete, rsync instead writes the updated data directly to the destination file.

--partial
By default, rsync will delete any partially transferred file if the transfer is interrupted. In some circumstances it is more desirable to keep partially transferred files.

Sounds like if the file is very big, you would want to use --partial --append. (--append implies --inplace) If this big file changes, then drop the --append and rsync will check the beginning of the file to ensure it too matches the source file. --inplace to me sounds dangerous, except if you are rsyncing a big file, you don't want rsync to create a new temporary file of the beginning part, continue the transfer, then remove the old file to put the new file in place. The transfer would go faster if you could use the same file, not to mention the disk space needed for the transfer would be less.

Also, I've found from a whole file transfer stand point a copy is faster than rsync. However, if I needed to update a file, I've had rsync sync the file faster than retransferring the whole file again. (like I said above) Rsync should be able to resume from a cp.

I hope this helps.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.