Diff for "rsync"


Differences between revisions 25 and 29 (spanning 4 versions)
Revision 25 as of 2009-07-28 17:12:29
Size: 9340
Editor: 69-196-134-37
Comment: Small edits.
Revision 29 as of 2009-09-27 23:58:59
Size: 9426
Editor: 69-165-137-106
Comment: Install fixed.
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
rsync is usually installed on ubuntu. In the rare case when it is not on your system, do the following step to install rsync:
{{{
$ sudo apt-get install rsync xinetd
}}}
rsync is usually installed on Ubuntu. In the rare case when it is not on your system, [[InstallingSoftware#installing-a-package|install the following packages]]: '''''[[apt:rsync,xinetd|rsync xinetd]]'''''.
Line 117: Line 114:
The program grsync does not come installed by default on Ubuntu or any other distrubtion but it is easily available from the main [[Repositories]]. This can be installed either graphically through [[SynapticHowto|Synaptic Package Manager]] or by a terminal interface with AptGet. The package required is called '''grsync''', install it by your preferred means before continuing. The program grsync does not come installed by default on Ubuntu or any other distrubtion but it is easily available from the main [[Repositories]]. To get grsync ensure '''Universe''' section of the Ubuntu repositories is enabled in your [[Repositories/Ubuntu|Software Sources]]. Then to install this software in Ubuntu, [[InstallingSoftware#installing-a-package|install the following package]]: '''''[[apt:grsync|grsync]]'''''.
Line 137: Line 134:
 * '''Advanced Options''' - This tab holds more options, many are useful and self-explanitory. For those not understood, tooltips will be displayed when the mouse remains over an option log enough.  * '''Advanced Options''' - This tab holds more options, many are useful and self-explanitory. For those not understood, tooltips will be displayed when the mouse remains over an option long enough.

Introduction

rsync is a program that copies files from one location to another. With it you can make backups of your files, and synchronize data on different locations and computers. It is commonly used by unix users to keep a safe backup of their files and is often recommended as the simplest solution for backups and safety copys. Other software for backup is listed on BackupYourSystem.

Rsync minimizes 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.

This document is a rsync quick howto.

rsync

Installation

rsync is usually installed on Ubuntu. In the rare case when it is not on your system, install the following packages: rsync xinetd.

Using rsync with SSH for a Simple Backup

(This example is also given on BackupYourSystem)

Rsync updates the copies of files that have changed, and even then only transfers the parts of those files that have changed. That is useful for saving bandwidth when backing up over the network. Rsync is especially good for backing up home directories. For safety, transfer between two machines is done via SSH. Also, SSH is installed on most unix machines, so this method will be easier for you to use.

The command for transferring to a remote machine is:

sudo rsync --delete -azvv -e ssh /home remoteuser@remotehost.remotedomain:./backupdirectory

In the above example:

  • --delete deletes files that don't exist on the system being backed up.(Optional)

  • -a preserves the date and times, and permissions of the files (same as -rlptgoD).

  • With this option rsync will:
    • Descend recursively into all directories (-r),

    • copy symlinks as symlinks (-l),

    • preserve file permissions (-p),

    • preserve modification times (-t),

    • preserve groups (-g),

    • preserve file ownership (-o), and

    • preserve devices as devices (-D).

  • -z compresses the data

  • -vv increases the verbosity of the reporting process

A complete synopsis of all the options with the rsync command can be found in the man pages under "Options Summary". The man page for rsync can also be found on linux.die.net

rsync has several graphical frontends: grsync, Backup Monitor, QSync, Zynk, rsyncbackup, TKsync

Configuration of the rsync Daemon

You need the rsync daemon when you want to synchronize two computers and the simple way using SSH doesn't work for you. Using the daemon is usually more complicated than just using rsync with an ssh connection.

1. Edit /etc/default/rsync to start rsync as daemon using xinetd.

$ sudo vim /etc/default/rsync
  RSYNC_ENABLE=inetd

2. Create /etc/xinetd.d/rsync to launch rsync via xinetd.

$ sudo vim /etc/xinetd.d/rsync
  service rsync
    {
        disable         = no
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
    }

3. Create /etc/rsyncd.conf configuration for rsync in daemon mode.

$ sudo vim /etc/rsyncd.conf
  max connections = 2
  log file = /var/log/rsync.log
  timeout = 300

  [share]
  comment = Public Share
  path = /home/share
  read only = no
  list = yes
  uid = nobody
  gid = nogroup
  auth users = user
  secrets file = /etc/rsyncd.secrets

4. Create /etc/rsyncd.secrets for user's password.

$ sudo vim /etc/rsyncd.secrets 
  user:password

4.a

$ sudo chmod 600 /etc/rsyncd.secrets

5. Start/Restart xinetd

$ sudo /etc/init.d/xinetd restart

Testing

Run the following command to check if everything is ok.

$ sudo rsync user@192.168.0.1::share
  Password: 
  drwxr-xr-x        4096 2006/12/13 09:41:59 .
  drwxr-xr-x        4096 2006/11/23 18:00:03 folders

grsync

The program grsync is a GUI front for rsync. The simple interface of the GUI exposes many of the basic options usable with rsync and is useful for those not wishing to use the command line.

Installation

The program grsync does not come installed by default on Ubuntu or any other distrubtion but it is easily available from the main Repositories. To get grsync ensure Universe section of the Ubuntu repositories is enabled in your Software Sources. Then to install this software in Ubuntu, install the following package: grsync.

Configuration

To start up grsync go through the following menus: Applications --> System Tools --> grsync. Upon start up you'll be presented with the main window, where all the configuration takes place.

grsyn1.png

On this window are all of the options most users will ever need. To explain, the options will be listed and their effects mentioned.

  • Sessions - This function is the same as profiles in others. Each session will store a different set of source and destination directories, as well as the configuration options associated with the folder pair. This allows for the synchronization of different sets of folders according to different options.

    • Management of sessions is simple, simply push the Add button to add a new one. To delete, select the session you no longer want from the drop down and push Delete.

  • Source and Destination - These two boxes list the two folders (technically referred to as directories) that will be synchronized. The top one is the Source and the bottom the Destination. So when you Execute the synchronization, the files from Source will be copied over to the Destination according to the options a user selects.

    • To specify the directories either Browse for them from the GUI or type them in according to the standard path conventions.

  • Switch - The universal reload sign located to the right of the Browse buttons is a handy button. It will instantly switch the Source with the Destination.

  • Import and Export - After having configured sessions, a user may want to back them up for storage. To do so, simply go to the Sessions Menu at the top and select either Import or Export. The former will restore a session from a backup previously made, the latter will make a backup of the current session.

    • Note: This backup function works on a per session basis. This means, each session you want to back up must be selected from the drop down and then backed up. If you have 3 different sessions, select each in turn and Export them. Same when importing sessions.

  • Basic Options - Most users will find most of the options they will ever need here. The first four will preserve the properties of the files transferred. The others will modify how the files are copied. For more information on what each does specifically, hover your stationary cursor over the option and it will display a small explanation. The options checked are of course the ones that will be applied during the session.

grsyn2.png

  • Advanced Options - This tab holds more options, many are useful and self-explanitory. For those not understood, tooltips will be displayed when the mouse remains over an option long enough.

  • Additional Options - This entry box allows the input of additional options not presented in the GUI but known to the user. Use is suggested only for experienced users, inputting malformed options may have unexpected consequences.

Simulation and Execution

The last two buttons on the window are Simulation and Execute. The button for simulation is very useful when uncertain what will happen based on the options selected. The normal transfer dialog screen will pop up and in the main pane, a list of files that would have been copied over is listed. The user can then verify if this is as desired or make changes. Once the session is initiated with the Execute button, the dialog will appear again but this time it will actually process the folders accordingly. Ensure before pushing Execute that you are happy with the simulation.

Remote Backup

Backup over a network is possible, preferably the user should mount the network share to be backed up to prior to launching the program. The share would then be listed in the Browse GUI and could easily be added. There is no separate section for network, if more advanced features are required the user is encouraged to look at alternatives, of which there are many.

Alternatives

There are many alternatives, in various stages of development. For an incomplete list, see here.


CategoryBackupRecovery CategoryCommandLine

rsync (last edited 2012-09-05 19:05:54 by mail)