rsync

rsync
rsync
Newrsynclogo.png
Original author(s) Andrew Tridgell, Paul Mackerras
Developer(s) Wayne Davison
Initial release June 19, 1996 (1996-06-19)[1]
Stable release 3.0.9  (September 23, 2011; 58 days ago (2011-09-23))[2] [+/−]
Development status active
Written in C
Platform Unix-like, Windows
Type Data transfer, Differential backup
License GNU GPLv3
Website rsync.samba.org

rsync is a software application and network protocol for Unix-like and Windows systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction. rsync can copy or display directory contents and copy files, optionally using compression and recursion.

In daemon mode, rsync listens on the default TCP port of 873, serving files in the native rsync protocol or via a remote shell such as RSH or SSH. In the latter case, the rsync client executable must be installed on the remote machine as well as on the local machine.

Released under the GNU General Public License version 3, rsync is free software. It is widely used.[3][4][5][6]

Contents

History

Andrew Tridgell and Paul Mackerras wrote the original rsync. Tridgell discusses the design, implementation and performance of rsync in chapters 3 through 5 of his Australian National University PhD thesis.[7]

rsync was first announced on 19 June 1996.[1] Rsync 3.0 was released on 1 March 2008.[8]

Uses

rsync was originally written as a replacement for rcp and scp. As such, it has a similar syntax to its parent programs.[9] Like its predecessors, it still requires a source and a destination to be specified, one of which may be remote. Because of the flexibility, speed and scriptability of rsync, it has become a standard Linux utility and is included in all popular Linux distributions. As a result, rsync has been ported to Windows (via Cygwin), Mac OS and GNU/Linux.

Possible uses:

rsync [OPTION] … SRC [SRC][USER@]HOST:DEST
rsync [OPTION][USER@]HOST:SRC [DEST]

One of the earliest applications of rsync was to implement mirroring or backup for multiple Unix clients to a central Unix server using rsync/ssh and standard Unix accounts.

With a scheduling utility such as cron, one can schedule automated encrypted rsync-based mirroring between multiple hosts and a central server.

Unison is a file synchronization program that uses the rsync algorithm. It is used, for example, for synchronizing two normally-identical directories on two computers that are both subject to editing. In other words, when two devices are synchronized, the user can be sure that the most current version of a file is available on both devices, regardless of where it was last modified.

Examples

A command line to mirror FreeBSD might look like:

% rsync -vaz --delete ftp4.de.FreeBSD.org::FreeBSD/ /pub/FreeBSD/[10]

The Apache HTTP Server only supports rsync for updating mirrors.

rsync -avz --delete --safe-links rsync.apache.org::apache-dist /path/to/mirror[11]

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

rsync -auH rsync://rsync.chiark.greenend.org.uk/ftp/users/sgtatham/putty-website-mirror/ .[12]

A way to mimic the capabilities of Time Machine (Mac OS).

date=`date "+%Y-%m-%dT%H:%M:%S"`
rsync -aP --link-dest=$HOME/Backups/current /path/to/important_files $HOME/Backups/back-$date
rm -f $HOME/Backups/current
ln -s back-$date $HOME/Backups/current[13]

Algorithm

The rsync utility uses an algorithm invented by the 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 fixed-size non-overlapping chunks and computes two checksums for each chunk: the MD4 hash, and a weaker 'rolling checksum'. (Version 30 of the protocol, released with rsync version 3.0.0, now uses MD5 hashes rather than MD4.[14]) It sends these checksums to the sender.

The sender computes the rolling checksum for every chunk of size S in its own version of the file, even overlapping chunks. This can be calculated efficiently because of a special property of the rolling checksum: if the rolling checksum of bytes n through n + S − 1 is R, the rolling checksum of bytes n + 1 through n + S can be computed from R, byte n, and byte n + S without having to examine the intervening bytes. Thus, if one had already calculated the rolling checksum of bytes 1–25, one could calculate the rolling checksum of bytes 2–26 solely from the previous checksum, and from bytes 1 and 26.

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.

The sender then compares its rolling checksums with the set sent by the recipient to determine if any matches exist. If they do, it verifies the match by computing the hash for the matching block and by comparing it with the hash for that block sent by the recipient.

The sender then sends the recipient those parts of its file that did not match the recipient's blocks, along with information on where to merge these blocks into the recipient's version. This makes the copies identical. However, there is a small probability that differences between chunks in the sender and recipient are not detected, and thus remains uncorrected. This requires a simultaneous hash collision in MD5 and the rolling checksum. It is possible to generate MD5 collisions, and the rolling checksum is not cryptographically strong, but the chance for this to occur by accident is nevertheless extremely remote. With 128 bits from MD5 plus 32 bits from the rolling checksum, and assuming maximum entropy in these bits, the probability of a hash collision with this combined checksum is 2−(128+32) = 2−160. The actual probability is a few times higher, since good checksums approach maximum output entropy but very rarely achieve it.

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.

While the rsync algorithm forms the heart of the rsync application that essentially optimizes transfers between two computers over TCP/IP, the rsync application supports other key features that aid significantly in data transfers or backup. They include compression and decompression of data block by block using zlib at sending and receiving ends, and support for protocols such as ssh that enables encrypted transmission of compressed and efficient differential data using rsync algorithm. Instead of ssh, stunnel can also be used to create an encrypted tunnel to secure the data transmitted.

Finally, rsync is capable of limiting the bandwidth consumed during a transfer, a useful feature that few other standard file transfer protocols offer.

Variations

A utility called rdiff 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).

Unlike diff, the process of creating a delta file has two steps: first a signature file is created from file A, and then this (relatively small) signature and file B are used to create the delta file. Also unlike diff, rdiff works well with binary files.

Using rdiff, a utility called rdiff-backup has been created, capable of maintaining 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.

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, then retrieving 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.

An alternative to manually scripting rsync is the Free Software (FLOSS) GUI program BackupPC, which performs automatic scheduled backups to rsync servers.

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 proprietary Resource Fork along with the Data Fork.[15]

Practical applications

rsync can be used as a method to intelligently copy or backup files from one location to another. For example, within the iTunes music library, all music files are located within an artist folder, with an album subdirectory. If you have an external hard drive that serves as a backup of your music, it can be frustratingly slow to go through the recent additions of (e.g., a new album within an old artist) music on your computer, and to make sure that they are backed up on the external hard drive. If you were to just copy the artist folders, it would disregard the subdirectories, asking you to replace the entire directory. However, rsync can be used to scan all of the files in your music library, as well as the subdirectories, and to add only the ones that are not present on the external hard drive.

Graphical user interfaces

Name Linux Mac OS Windows Comments
BackupAssist No No Yes Direct mirror or with history, VSS
DSynchronize No No Yes
LuckyBackup Yes Yes No
gadmin-rsync Yes No No Part of Gadmintools
Grsync Yes Yes Yes
QtdSync Yes No Yes
PureSync No No Yes
FreeFileSync Yes No Yes VSS, Not based on rsync?
DeltaCopy No No Yes
Yintersync No No Yes VSS, Reporting, Scheduler.
Syncrify Yes No Yes
Backuplist+ No Yes No
RipCord Backup No Yes No
RsyncX No Yes No
arRsync No Yes No
Duplicati Yes No Yes
FolderWatch No Yes No Supports real-time and on-demand syncing

See also

References

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Rsync — Saltar a navegación, búsqueda rsync es una aplicación de software para sistemas de tipo Unix que ofrece transmisión eficiente de datos incrementales comprimidos y cifrados. Mediante una técnica de delta encoding, permite sincronizar archivos y… …   Wikipedia Español

  • rsync — Maintainer Wayne Davison Aktuelle Version 3.0.9 (23. September 2011) Betriebssystem Unix, Linux, Mac OS X, Microsoft Windows, OS/2 Kategorie …   Deutsch Wikipedia

  • Rsync — Maintainer: Wayne Davison Aktuelle Version: 3.0.5 (28. Dezember 2008) Betriebssystem: Unix, u. a. Linux, Mac OS X, Windows, OS/2 …   Deutsch Wikipedia

  • rsync — Développeurs Andrew Tridgell, Paul Mackerras Dernière version …   Wikipédia en Français

  • Rsync — Разработчик Wayne Davison ОС Кроссплатформенное программное обеспечение Версия 3.0.7 (31 декабря 2009) Лицензия GPL Сайт …   Википедия

  • rsync — Разработчик Wayne Davison Операционная система Кроссплатформенное программное обеспечение Последняя версия 3.0.9 (23 сентября 2011) Лицензия GPL Сайт …   Википедия

  • Rsync — Développeurs Andrew Tridgell, Paul Mackerras Dernière version …   Wikipédia en Français

  • Rsync — infobox software name = rsync caption = rsync logo author = Andrew Tridgell, Paul Mackerras developer = Wayne Davison latest release version = 3.0.4 latest release date = September 6 2008 genre = Data transfer/ differential backup license = GNU… …   Wikipedia

  • RsyncX — rsync Maintainer: Wayne Davison Aktuelle Version: 3.0.5 (28. Dezember 2008) Betriebssystem: Unix, u. a. Linux, Mac OS X, Windows, OS/2 …   Deutsch Wikipedia

  • Rsyncx — rsync Maintainer: Wayne Davison Aktuelle Version: 3.0.5 (28. Dezember 2008) Betriebssystem: Unix, u. a. Linux, Mac OS X, Windows, OS/2 …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”