Size: 578
Comment:
|
Size: 4106
Comment: copied text about ssh-rsync from BackupYourSystem. Removed note of unusefullness
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
'''rsync''' is a program that behaves in much the same way that rcp does, but has many more options and uses the rsync remote-update protocol to greatly speed up file transfers when the destination file is being updated - rsync(1). | '''rsync''' is a program that copies file from one location to another, with it you can make '''backups''' of your files, '''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. |
Line 6: | Line 10: |
To install rsync do the following steps: | rsync is usually installed on ubuntu. In the rare case when it is not on your system, do the following step to install rsync: |
Line 8: | Line 12: |
$ sudo apt-get install rsync | $ sudo apt-get install rsync xinetd |
Line 11: | Line 15: |
= Configuration = | = Using RSYNC with SSH for a simple backup = (This example is also given on BackupYourSystem) |
Line 13: | Line 18: |
Rsync updates the copies the 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. |
|
Line 14: | Line 21: |
The command for transferring to a remote machine is: {{{ sudo rsync --delete -azvv -e ssh /home remoteuser@remotehost.remotedomain:./backupdirectory }}} {{{-z}}} compresses the data {{{--delete}}} deletes files that don't exist on the system being backed up. Maybe you want this, maybe not. {{{-a}}} preserves the date and times of the files (same as {{{-t}}}), descends recursively into all directories (same as {{{-r}}}), copies symlinks as symlinks (same as {{{-l}}}), preserves file permissions (same as {{{-p}}}), preserves groups (same as {{{-g}}}), preserves file ownership (same as {{{-o}}}), and preserves devices as devices (same as {{{-D}}}). {{{-vv}}} increases the verbosity of the reporting process rsync has several [http://www.debianadmin.com/rsync-backup-web-interfacefrontend-or-gui-tools.html 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 }}} |
ContentsBRTableOfContents(2) |
Introduction
rsync is a program that copies file from one location to another, with it you can make backups of your files, 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.
Installation
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
Using RSYNC with SSH for a simple backup
(This example is also given on BackupYourSystem)
Rsync updates the copies the 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
-z compresses the data --delete deletes files that don't exist on the system being backed up. Maybe you want this, maybe not. -a preserves the date and times of the files (same as -t), descends recursively into all directories (same as -r), copies symlinks as symlinks (same as -l), preserves file permissions (same as -p), preserves groups (same as -g), preserves file ownership (same as -o), and preserves devices as devices (same as -D). -vv increases the verbosity of the reporting process
rsync has several [http://www.debianadmin.com/rsync-backup-web-interfacefrontend-or-gui-tools.html 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