Rsync hangs transfer

How to fix hanging transfers when using Rsync.

Rsync may hang on transfer of files and folders. Usually this is caused by using the wrong options with the Rsync command.

Insufficient memory

Thee Memory usage of Rsync is directly proportional to the size and number of directories transferred. Maintain an adequate amount of free memory on the server for Rsync operations.

You can analyze the memory using commands such as:

$ cat /proc/meminfo
$ vmstat -s
$ top -c

Wrong Rsync options

Generally, the Rsync transfer hangs if incorrect options are being used.

Use -P or --partial --progress to tell Rsync to keep partially transferred files (by default it deletes them).

Use -timeout=0 to not allow Rsync to timeout.

Use -z to compress files during the data transfer.

Upgrade Rsync

Upgrade Rsync to the latest version.

Check that Rsync version you're using on both the local machine and remote machine:

$ rsync --version

Update Rsync to the latest version:

  • Ubuntu and Debian*

     $ apt-get --only-upgrade install rsync
  • CentOS, RedHat, Fedora

      $ yum update rsync