14

I would like to interrupt rsync with ctrl-c (let's say after half the file has transferred) and resume without having to resend the data that has already been transferred.

The stackexchange/google information I have found seems conflicting. I found some some who say use --partial and some who say use --append. To me it sounds like they both would work.

If I want to interrupt rsync with ctrl-c, should I use --partial or --append?

If both would work, when is it better to use one vs the other?

8

To restart, --partial is sufficient. Use --inplace if you really don't want rsync to create a temporary file that merges the existing copied data and the new, for example if rsync will have permissions issues creating a temporary file in the target folder.

Only use --append if you can guarantee that the partially copied data is still identical to the source. (Generally this is a false optimisation.)

| improve this answer | |
  • 1
    so when i use the above options (actually using --append-verify) and rsync still claims it is starting from the beginning, and I don't see any change in the file-size and the remaining file time is what it originally was when I started the copy, is rsync lying, or should I be worried? – Michael May 21 '16 at 7:27
  • @Michael if you have a local source and destination all the rules change. – roaima May 21 '16 at 10:48
  • I was doing it across the LAN, but after a bit more experimenting, it appears that the issue is that since --append-verify actually has to actually read the parts of the file on both sides that are there, t isn't any faster due to the bottleneck being an older drive on the read side and not the LAN itself. – Michael May 21 '16 at 15:41
  • @Michael well yes, if you've asked for verification of the data already transmitted then it has to read the data! – roaima May 21 '16 at 16:05
  • 1
    @alper I've never noticed that option before. It looks like it would be best to use --partial-dir, but I've not yet tried it. – roaima Oct 15 '18 at 9:40
3
  • --append presumes the file may already exist in the destination, it just makes rsync not check the content already there (but see below).
  • --partial tells rsync to not delete partially transferred files.

You'll also need --inplace with --partial (it is implied with --append).

Turns out --inplace actually implies --partial, this is why --append is enough (it implies --inplace which implies --partial). But --partial alone is not enough, you need --inplace, otherwise rsync creates temp files instead of updating the final one.

| improve this answer | |
  • If I want to interrupt rsync with ctrl-c, I would use --append? Because --partial by itself would not resume. – Trevor Boyd Smith May 13 '15 at 10:57
  • I'd use just --inplace. rsync "always resumes" (it tries to transfer the minimal data needed). What --append does is tell rsync to not checksum the data already at the destination, so if the partial file at the destination has been corrupted, it will stay corrupted with --append. --append might be interesting if, say, the partial file is very large and you can't wait (and is sure or don't care if it's corrupted), or some other specific situation. – spuk May 13 '15 at 11:54
  • 1
    on Fedora 20 man rsync the option --append says ... Implies --inplace – Trevor Boyd Smith May 13 '15 at 12:25
  • 1
    --inplace will work. --append will work because (as I stated in the answer) it implies --inplace, which implies --partial (which will keep partially transferred files when interrupted by Ctrl-c, which was the original question). So --append means "do as --inplace, but don't checksum what's already in the destination. It is an important difference. If you don't care about it, use either. – spuk May 13 '15 at 12:38
  • 1
    so then what's the point of --partial WITHOUT --inplace – Evan Carroll Mar 17 '17 at 20:17

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.