Skip to content

[Linux] Resuming Interrupted File Transfer on Different Devices via Rsync

Last Updated on 2022-05-26 by Clay

We always have some needs to transfer data between different devices, for example, may be I need to transfer a file from server A to B.

We always think about use scp command to do that, but in the unlikely event that the connection is interrupted due to network instability, you will be horrified to find out that scp does not support the transfer of files from the breakpoint, and we need to restart the transfer of the entire file...

Fortunately, the rsync command supports this feature. This article briefly records how to use this command to resume the upload from a breakpoint.


Use rsync command completes the breakpoint resuming

rsync -P --rsh=ssh [FILE] [REMOTE_IP]:~/


More detailed introductions can be viewed with man rsync.

In addition, there are many teaching recommendations on the Internet to set alias to simplify the instructions, which I also find very convenient.

First you can use any editor you prefer to open the ~/.bashrc, and write down the following command:

# Alias
alias rscp="rsync -P --rsh=ssh"


Save and exit, then activate the setting:

source ~/.bashrc


By the way, if the transfer port of the server had changed, you can add the following parameters for it:

rsync -P -e 'ssh -p xxxx' [FILE] [REMOTE_IP]:~/


Where -p xxxx is to fill in the specified port.


References


Read More

Tags:

Leave a ReplyCancel reply

Exit mobile version