Resume rsync transfers with the --partial switch
Recently I wanted to rsync a 16GB file to a remote server. The ETA was calculated as 23 hours and, as it usually happens, the file transfer aborted after about 20 hours due to a changing dynamic IP address of the modem. I thought: “No problem, I just re-run the rsync command and the file transfer will resume where it left off.” Wrong!
Because, by default, on the remote side, rsync creates a temporary file beginning with a dot, and once aborted during the file transfer, this temporary file is deleted without a trace! Which, in my case, meant that I wasted 20 hours of bandwidth.
It turns out that one can tell rsync to keep temporary files by passing the argument
--partial. I tested it, and the temporary file indeed is kept around even after the file transfer aborts prematurely. Then, when simply re-running the same rsync command, the file transfer is resumed.
In my opinion, rsync should adopt this behavior by default. Simple thing to fix, but definitely an argument that should be passed every time!
Added: Simply use
-P. This implies
--partial and we also get a nice progress output.