Filesystem Administration  «Prev  Next»

Lesson 7 Network file synchronization,
Objective Use rsync to synchronize files between the local host and a remote machine.

Network File Synchronization

A newer more flexible, and potentially more secure mechanism is rsync. rsync uses an efficient algorithm to copy only changes to files, rather than requiring the transfer of entire files across a network.
rsync has file exclusion mechanisms that inform rsync which files to keep out of the transfer. For example, .bak files can be excluded so that multiple copies of backup files are not transferred. The exclusion mechanisms are compatible with both tar and CVS , and may be implemented as either a host-to-host or a client-server mechanism.
Most importantly, rsync can use ssh as the transport mechanism rather than the older, insecure rsh. Consequently, all communications can be encrypted, and use of RSA keys for authentication is available.
  1. CVS: Concurrent Versions System, is a system that keeps a set of files in sync.
  2. rsh: sh, the remote shell, is a utility that allows users to log in to a remote system. However, it does not use any type of encryption and therefore is insecure.

The diagram below contains the syntax of the rsync command.
rsync parameters
  1. --verbose --progress --stats: These options allow you to view the status of the data transfer.
  2. --compress: This option tells rsync to use compress during the transfer.
  3. --rsh=/usr/local/bin/ssh: This option tells rsync to use the secure shell to transfer the data and the path to find the ssh utility.
  4. --recursive: This option tells rsync to follow the source pathname, recursively transferring files that have been added or altered.
  5. --times --perms: These options preserve the file timestamps and permissions.
  6. /files/*: /files/* specifies which local filesystem rsync should transfer files from for transmission to the remote rsync server.
  7. fileserver: fileserver should be the DNS name or IP address of your rsync server. It is important that you only use one colon to separate the DNS name for the path. Otherwise, rsync will use rsh to perform the transfer instead of ssh.
  8. rsync_server_path_name: rsync_server_path_name specifies the path the files should be transferred to on the rsync server.

rsync Command Syntax
The next lesson lists the commands for monitoring filesystem usage.