Contents[Show]

1. Intro

Rsync will compare a source and a target folder and synchronize them. The folders aren't necessarily on the same computer of course.
The goal is to run the command quickly as well as use minimal bandwidth.

 

2. Command

All in one row. Parameter explanations below.

# rsync --archive -vv --rsh=ssh --compress --sparse --stats --progress --ignore-existing server1.domain.com:/foo/ /bar

Note: No slash after /bar.
Why? See sources below.
In short; the contents of server1.domain.com:/foo/ should be synced to the folder /bar, not to /bar/foo.

2.1. --archive

The same as using
-r recursive
--links (recreate sym)
--perms
--owner destination owner = source owner
--group ditto group
--devices transfer char and block devices
--times transfer modification times

2.2. --vv

Be very verbose about what it's doing.

2.3. --rsh=ssh

This option allows you to choose an alternative remote shell program to use for communication between the local and remote copies of rsync. Typically, rsync is configured to use ssh by default, but you may prefer to use rsh on a local network.

2.4. --compress

Use file compression while transferrring.

2.5. --sparse

Efficiently handle sparse files. 
A sparse file is a type of computer file that attempts to use file system space more efficiently, when the file itself is partially empty.

2.6. --stats
--progress

See what the command is doing and how long it's been running. Usable when a big job is running.

2.7. --ignore-existing

Will leave already existing files in the destination folder as is.

 

3. Sources

https://linux.die.net/man/1/rsync

https://rimuhosting.com/howto/rsync.jsp

https://en.wikipedia.org/wiki/Sparse_file

https://unix.stackexchange.com/questions/50499/when-should-i-use-a-trailing-slash-on-a-directory