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.

 

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.

--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

--vv

Be very verbose about what it's doing.

--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.

--compress

Use file compression while transferrring.

--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.

--stats
--progress

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

--ignore-existing

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

 

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

Stop Spam Harvesters, Join Project Honey Pot

 

Get a free SSL certificate!

 

The leading nonprofit defending digital privacy, free speech, and innovation.

 

The Linux Foundation provides a neutral, trusted hub for developers and organizations to code, manage, and scale open technology projects and ecosystems.

 

Kubuntu is an operating system built by a worldwide community of developers, testers, supporters and translators.

 

 43ef5c89 CanonicalUbuntudarktext