World Library  
Flag as Inappropriate
Email this Article


Original author(s) Andrew Tridgell, Paul Mackerras
Developer(s) Wayne Davison
Initial release June 19, 1996 (1996-06-19)[1]
Stable release 3.1.1 (June 22, 2014 (2014-06-22)) [2]
Development status active
Written in C
Platform Unix-like, Windows
Type Data transfer, Differential backup
License GNU GPLv3
Website .org.sambarsync

Rsync is a widely-used utility to keep copies of a file on two computer systems the same.[3] It is commonly found on Unix-like systems and functions as both a file synchronization and file transfer program. The rsync algorithm, a type of delta encoding, is used to minimize network usage. Zlib may be used for additional compression,[4] and SSH or stunnel can be used for data security.

Rsync is typically used to synchronize 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.[5] Once connected, it will invoke the remote host's rsync and then the two programs will determine what parts of the file need to be transferred over the connection.

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

It is released under the GNU General Public License version 3.[3][6][7][8]


  • History 1
  • Uses 2
  • Examples 3
  • Algorithm 4
    • Determining which files to send 4.1
    • Determining which parts of a file have changed 4.2
  • Variations 5
  • rsync applications 6
  • See also 7
  • References 8
  • External links 9


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]


Similar to rcp and scp, rsync requires the specification of a source and of a destination; either of them may be remote, but not both.[11] 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[12]) and Mac OS.

Generic syntax:


...where SRC is the file or directory (or a list of multiple files and directories) to copy from, and DEST represents the file or directory to copy to. (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.

By default, rsync uses the remote-shell program SSH for its communication. It can be configured to use a different remote-shell program, or to contact an rsync daemon directly via TCP, which per default then is via TCP port 873.


A command line to mirror FreeBSD might look like:

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

The Apache HTTP Server supports only rsync for updating mirrors.

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

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

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

A way to mimic the capabilities of Time Machine (Mac OS) - see also tym.[16]

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

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


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. As this only requires reading file directory information, it is quick, but it will miss unusual modifications which change neither.

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

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'.[18] 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 an unlikely 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 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.[19]

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.[20] It is used by Dropbox, rdiff-backup, duplicity, and other utilities.[20]

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.

rsyncrypto is a utility to encrypt files in an rsync-friendly fashion. The rsyncrypto algorithm ensures that two almost identical files, when encrypted with rsyncrypto and the same key, will produce almost identical encrypted files. This allows for the low-overhead data transfer achieved by rsync while providing encryption for secure transfer and storage of sensitive data in a remote location.[21]

The BackupPC suite performs automatic scheduled backups and supports the rsync protocol.

As of Mac OS X 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.[22]

Acrosync is an independent, cross-platform rsync implementation that is not based on the rsync source code. Native Windows, Mac OS X, and iOS clients are currently available.[23]

zsync is a rsync like tool optimized for many downloads per file version. zsync is used by Linux distributions such as Ubuntu[24] 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.

rsync applications

Program Operating system Free software Description
Linux OS X Windows
Acrosync No Yes Yes No Alternative client with built-in file monitor to support automatic upload.[23] / Also see: acrosync-library on GitHub - Independent implementation of rsync library used by Acrosync is released under the Reciprocal Public License
Back In Time Yes No No Yes
BackupAssist No No Yes No Direct mirror or with history, VSS.
Carbon Copy Cloner No Yes No No Tool for cloning, backing up and synchronising volumes/folders.
Cwrsync No No Yes No Free Edition available. Based on Cygwin
DeltaCopy No No Yes Yes Open Source, Free, Based on Cygwin[25]
Dirvish Yes Partial No Yes Backup software for taking incremental snapshots. Free software (Open Software License v2.0).
Fpart Yes Yes No Yes Split a file tree into sub-trees and launch external command (such as rsync) over generated parts (C, BSD-licensed)
gadmin-rsync Yes No No Yes Part of Gadmintools
Grsync Yes Yes Yes[26] Yes Graphical Interface for rsync on Linux Systems
Handy Backup Yes No Yes No Uses rsync for delta-copying and for differential backup.
LuckyBackup Yes Yes Yes Yes
QtdSync Yes No Yes Yes
rdiff-backup Yes Yes Yes Yes Incremental backups. archfs (nowadays called rdiff-backup-fs which is more accurate) allows the backup to be mounted as a drive, making all versions accessible as snapshots.
RipCord Backup No Yes No ?
rsnapshot Yes Yes Yes Yes Snapshot-generating backup-tool using Rsync and hard links
RsyncX No Yes No Yes
Syncrify Yes Yes Yes No Free for personal use. Uses rsync protocol over HTTP(S). AES encryption, GUI, 2-way synchronization. Written in Java.
tym[27] Yes No No Yes
Unison Yes Yes Yes Yes Two-way file synchronizer using Rsync algorithm
Space Machine Yes Yes No Yes Simplifies internet sync with job files, desktop/email notification, compressed archive, open source bash script

See also


  1. ^ a b
  2. ^
  3. ^ a b
  4. ^
  5. ^
  6. ^
  7. ^ In-Place Rsync: File Synchronization for Mobile and Wireless Devices, David Rasch and Randal Burns, Department of Computer Science, Johns Hopkins University
  8. ^
  9. ^ Andrew Tridgell: Efficient Algorithms for Sorting and Synchronization, February 1999. Retrieved 29 Sept. 2009.
  10. ^
  11. ^ See the README file
  12. ^
  13. ^
  14. ^
  15. ^
  16. ^
  17. ^
  18. ^ NEWS for rsync 3.0.0 (1 Mar 2008)
  19. ^ rdiff-backup
  20. ^ a b Martin Pool. "librsync".
  21. ^ rsyncrypto
  22. ^
  23. ^ a b
  24. ^
  25. ^
  26. ^ Grsync for Windows
  27. ^ Time rsYnc Machine (tym)

External links

  • Official website
  • rsync algorithm - 1998-11-09
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.