Resume rsync when the connection is down

How do you resume rsync when the connection between hosts is cut by a ... mouse maybe 😊?

Published on: May 11, 2020 by Website Admin

Well rsync has some flags you can give so when the connection between hosts is re-established the rsync starts without any problems.

In order to transfer "file-i-want-to-transfer.txt" from local server to a remote server I hit the following command and even if the connection is dropped at some point, once the connection is reestablished the rsync will resume where it was left over:

rsync --progress --archive --compress --partial --append --recursive file-i-want-to-transfer.txt [email protected]:/tmp/file-i-want-to-transfer.txt

What does the above parameter do you ask? Well ... the following:

--progress = show the progress bar
--archive = use archive mode to preserve almost everything, permissions, symlinks, etc.
--compress = compress the files during the transfer
--partial = this tells rsync to keep the partial file transferred
--recursive = well this is self explanatory...

And that's it...