rsync is a utility for efficiently transferring and synchronizing files between a computer and an external hard drive and across networked computers by comparing the modification times and sizes of files.[3] It is commonly found on Unix-like operating systems. The rsync algorithm is a type of delta encoding, and is used for minimizing network usage. Zlib may be used for additional data compression,[3] and SSH or stunnel can be used for security.

Original author(s)Andrew Tridgell, Paul Mackerras
Developer(s)Wayne Davison
Initial releaseJune 19, 1996 (1996-06-19)[1]
Stable release3.1.3 (January 28, 2018 (2018-01-28)) [±][2]
Written inC
TypeData transfer, differential backup

Rsync is typically used for synchronizing files and directories between two different systems. For example, if the command rsync local-file user@remote-host:remote-file is run, rsync will use SSH to connect as user to remote-host.[4] Once connected, it will invoke the remote host's rsync and then the two programs will determine what parts of the local file need to be transferred so that the remote file matches the local one.

Rsync can also operate in a daemon mode, serving and receiving files in the native rsync protocol (using the "rsync://" syntax).

It is licensed under the GNU General Public License.[5][6][7][8]


Andrew Tridgell and Paul Mackerras wrote the original rsync, which was first announced on 19 June 1996.[1] Tridgell discusses the design, implementation, and performance of rsync in chapters 3 through 5 of his Ph.D. thesis in 1999.[9] It is currently maintained by Wayne Davison.[10]

Because of the flexibility, speed, and scriptability of rsync, it has become a standard Linux utility, included in all popular Linux distributions. It has been ported to Windows (via Cygwin, Grsync, or SFU[11]), FreeBSD,[12] NetBSD,[13] OpenBSD,[14] and macOS.


Similar to cp, rcp and scp, rsync requires the specification of a source and of a destination, of which at least one must be local.[15]

Generic syntax:


where SRC is the file or directory (or a list of multiple files and directories) to copy from, DEST is the file or directory to copy to, and square brackets indicate optional parameters.

rsync can synchronize Unix clients to a central Unix server using rsync/ssh and standard Unix accounts. It can be used in desktop environments, for example to efficiently synchronize files with a backup copy on an external hard drive. A scheduling utility such as cron can carry out tasks such as automated encrypted rsync-based mirroring between multiple hosts and a central server.


A command line to mirror FreeBSD might look like:

$ rsync -avz --delete /pub/FreeBSD/[16]

The Apache HTTP Server supports only rsync for updating mirrors.

$ rsync -avz --delete --safe-links /path/to/mirror[17]

The preferred (and simplest) way to mirror the PuTTY website to the current directory is to use rsync.

$ rsync -auH rsync:// .[18]

A way to mimic the capabilities of Time Machine (macOS) - see also tym.[19]

$ date=$(date "+%FT%H-%M-%S") # rsync interprets ":" as separator between host and port (i. e. host:port), so we cannot use %T or %H:%M:%S here, so we use %H-%M-%S
$ rsync -aP --link-dest=$HOME/Backups/current /path/to/important_files $HOME/Backups/back-$date
$ ln -nfs $HOME/Backups/back-$date $HOME/Backups/current

Make a full backup of system root directory:[20]

 $ rsync -avAXHS --progress --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /path/to/backup/folder


An rsync process operates by communicating with another rsync process, a sender and a receiver. At startup, an rsync client connects to a peer process. If the transfer is local (that is, between file systems mounted on the same host) the peer can be created with fork, after setting up suitable pipes for the connection. If a remote host is involved, rsync starts a process to handle the connection, typically Secure Shell. Upon connection, a command is issued to start an rsync process on the remote host, which uses the connection thus established. As an alternative, if the remote host runs an rsync daemon, rsync clients can connect by opening a socket on TCP port 873, possibly using a proxy.[21]

Rsync has numerous command line options and configuration files to specify alternative shells, options, commands, possibly with full path, and port numbers. Besides using remote shells, tunnelling can be used to have remote ports appear as local on the server where an rsync daemon runs. Those possibilities allow adjusting security levels to the state of the art, while a naive rsync daemon can be enough for a local network.


Determining which files to send

By default, rsync determines which files differ between the sending and receiving systems by checking the modification time and size of each file. If time or size is different between the systems, it transfers the file from the sending to the receiving system. As this only requires reading file directory information, it is quick, but it will miss unusual modifications which change neither.[3]

Rsync performs a slower but comprehensive check if invoked with --checksum. This forces a full checksum comparison on every file present on both systems. Barring rare checksum collisions, this avoids the risk of missing changed files at the cost of reading every file present on both systems.

Determining which parts of a file have changed

The rsync utility uses an algorithm invented by Australian computer programmer Andrew Tridgell for efficiently transmitting a structure (such as a file) across a communications link when the receiving computer already has a similar, but not identical, version of the same structure.[22]

The recipient splits its copy of the file into chunks and computes two checksums for each chunk: the MD5 hash, and a weaker but easier to compute 'rolling checksum'.[23] It sends these checksums to the sender.

The sender quickly computes the rolling checksum for each chunk in its version of the file; if they differ, it must be sent. If they're the same, the sender uses the more computationally expensive MD5 hash to verify the chunks are the same.

The sender then sends the recipient those parts of its file that did not match, along with information on where to merge these blocks into the recipient's version. This makes the copies identical. There is a small probability that differences between chunks in the sender and recipient are not detected, and thus remain uncorrected. With 128 bits from MD5 plus 32 bits from the rolling checksum, the probability is on the order of 2−(128+32) = 2−160.

The rolling checksum used in rsync is based on Mark Adler's adler-32 checksum, which is used in zlib, and is itself based on Fletcher's checksum.

If the sender's and recipient's versions of the file have many sections in common, the utility needs to transfer relatively little data to synchronize the files. If typical data compression algorithms are used, files that are similar when uncompressed may be very different when compressed, and thus the entire file will need to be transferred. Some compression programs, such as gzip, provide a special "rsyncable" mode which allows these files to be efficiently rsynced, by ensuring that local changes in the uncompressed file yield only local changes in the compressed file.

Rsync supports other key features that aid significantly in data transfers or backup. They include compression and decompression of data block by block using zlib, and support for protocols such as ssh and stunnel.


The rdiff utility uses the rsync algorithm to generate delta files with the difference from file A to file B (like the utility diff, but in a different delta format). The delta file can then be applied to file A, turning it into file B (similar to the patch utility). rdiff works well with binary files.

rdiff-backup, not maintained since 2009,[24] maintains a backup mirror of a file or directory either locally or remotely over the network, on another server. rdiff-backup stores incremental rdiff deltas with the backup, with which it is possible to recreate any backup point.[25]

The librsync library used by rdiff is an independent implementation of the rsync algorithm. It does not use the rsync network protocol and does not share any code with the rsync application.[26] It is used by Dropbox, rdiff-backup, duplicity, and other utilities.[26]

The acrosync library is an independent, cross-platform implementation of the rsync network protocol.[27] Unlike librsync, it is wire-compatible with rsync (protocol version 29 or 30). It is released under the Reciprocal Public License and used by the commercial rsync software Acrosync.[28]

Duplicity is a variation on rdiff-backup that allows for backups without cooperation from the storage server, as with simple storage services like Amazon S3. It works by generating the hashes for each block in advance, encrypting them, and storing them on the server. It then retrieves them when doing an incremental backup. The rest of the data is also stored encrypted for security purposes.

As of macOS 10.5 and later, there is a special -E or --extended-attributes switch which allows retaining much of the HFS file metadata when syncing between two machines supporting this feature. This is achieved by transmitting the Resource Fork along with the Data Fork.[29]

zsync is an rsync-like tool optimized for many downloads per file version. zsync is used by Linux distributions such as Ubuntu[30] for distributing fast changing beta ISO image files. zsync uses the HTTP protocol and .zsync files with pre-calculated rolling hash to minimize server load yet permit diff transfer for network optimization.

Rclone is an open-source tool inspired by rsync that focuses exclusively on cloud storage system providers. It supports more than 10 different providers and provides an rsync-like interface to backup local data to those providers.[31]

rsync applications

ProgramOperating systemFree softwareDescription
Back In TimeYesNoNoYes
BackupAssistNoNoYesNoDirect mirror or with history, VSS.
cwRsyncNoNoYesNoBased on Cygwin.
GrsyncYesYesYes[32]YesGraphical Interface for rsync on Linux Systems.
GS RichCopy 360NoNoYes [33]NoDesigned only for MS Windows workstations and servers with VSS support.
RcloneYesYesYesYes Rsync clone that supports more than 10 cloud storage system providers.
RobocopyNoNoYesNoWindows tool with similar functionality.
SyncrifyYesYesYesNoUses rsync over HTTP(S).

See also


  1. Tridgell, Andrew (19 June 1996). "First release of rsync - rcp replacement". Newsgroup: comp.os.linux.announce. Usenet: Retrieved 2007-07-19.
  2. "NEWS for rsync 3.1.3 (28 Jan 2018)". rsync. 2018-01-28. Retrieved 2018-02-21.
  3. "rsync(1) - Linux man page". Retrieved 2017-02-02.
  4. "Using Rsync and SSH". Retrieved 2014-08-18.
  5. Sayood, Khalid (2002-12-18). Lossless compression handbook. Retrieved 2014-08-18.
  6. Web content caching and distribution: proceedings of the 8th International Workshop. Retrieved 2014-08-18.
  7. Rasch, David; Burns, Randal; In-Place Rsync: File Synchronization for Mobile and Wireless Devices, Department of Computer Science, Johns Hopkins University
  8. Dempsey, Bert J.; Weiss, Debra (1999-04-30). "Towards an Efficient, Scalable Replication Mechanism for the I2-DSI Project". Technical Report TR-1999-01. CiteSeerX
  9. Tridgell, Andrew; Efficient Algorithms for Sorting and Synchronization, February 1999, retrieved 2009-09-29
  10. "rsync". Retrieved 2014-11-28.
  11. "Tool Warehouse". SUA Community. Archived from the original on 2013-04-06.
  12. "FreeBSD Ports". Retrieved 2016-10-24.
  13. "NetBSD Ports". Retrieved 2016-10-24.
  14. "OpenBSD Ports". Retrieved 2016-10-24.
  15. See the README file
  16. "How to Mirror FreeBSD (With rsync)". Retrieved 2014-08-18.
  17. "How to become a mirror for the Apache Software Foundation". Retrieved 2014-08-18.
  18. "PuTTY Web Site Mirrors: Mirroring guidelines". 2007-12-20. Retrieved 2014-08-18.
  19. "Rsync set up to run like Time Machine". Retrieved 2014-08-18.
  20. "Full system backup with rsync". Retrieved 2014-12-15.
  21. "How Rsync Works".
  22. "RSync - Overview".
  23. NEWS for rsync 3.0.0 (2008-03-01)
  24. "Index of /releases/rdiff-backup/".
  25. rdiff-backup
  26. Pool, Martin; "librsync"
  27. Chen, Gilbert. "acrosync-library".
  28. "".
  29. "Mac Developer Library". Archived from the original on 2012-09-26. Retrieved 2014-08-18.
  30. "Zsync Cd Image". Retrieved 2015-01-06.
  31. Craig-Wood, Nick. "Overview of cloud storage systems". Retrieved 2017-07-10.
  32. "Grsync for Windows". SourceForge.
  33. "GS RichCopy 360 Enterprise - File Fast copy or sync software and rsync for windows".
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.