I. Introduction of Rsync
The rsync command is a remote data synchronization tool that enables fast synchronization of files between multiple hosts via Lan/wan. Rsync uses the so-called "rsync algorithm" to synchronize files between local and remote two hosts, which transmits only the different portions of two files, rather than the entire transfer every time, so it is quite fast.
The literal meaning you can understand as remote sync (remotely synced) can make you understand more deeply. Rsync can not only synchronize data remotely (similar to SCP [1]), but can also synchronize data locally (similar to CP), but unlike CP or SCP, rsync does not overwrite previous data like CP/SCP (if the data already exists), It will first determine the difference between the existing data and the new data, and only the different parts will be overwritten. If your Linux does not have the rsync command please use yum install-y rsync installation.
Second, rsync common options
Rsync
A?? Contains the-rtplgod
-r?? When synchronizing the directory, add the-r option like CP
V?? Show some information when synchronizing, let us know the process of synchronization
-l?? Keep Soft connections
-l?? After adding this option, synchronize the source files of the soft connection (if there is no source file in the other machine, the synchronization software connection is not valid in the past)
-P?? Keep File Permissions Property
-O?? Maintain a stable owner
-G?? Maintain a robust group of genera
-d?? Keep Device file information
T?? Keep the file time property
-P?? Shows the synchronization process, such as rate, more detailed than-V
-U?? If the target file is newer than the source file, it is out of sync with the new primary in the target file
Z?? Transfer-time compression (speeds up transfer and saves bandwidth)
--delte. Delete files that are not in the source directory in the destination directory
--exclude?? Filter the specified file, such as--exclude "logs" will be the file name contains logs files or directories filtered out of sync
Iii. Six modes of rsync
the pictures come from: http://blog.csdn.net/mrding991124/article/details/78735957
Linux Daily Maintenance (rsync Introduction, common options, rsync six modes)