Using rsync to syncronise / backup data
Note: Tested on the 12 January 2008 using version 2.6.9 on Debian Etch 4.0
Install rsync:
From the terminal run:
apt-get update
apt-get upgrade
apt-get install rsync
Note: If using across a network to another computer, rsync needs to be installed on both the server and the client
Using rsync (examples):
The examples below are where:
- SRC: the source directory (to be backed up)
- DEST: the destination directory (where the backup files are placed)
- USR: A user of the computer where the destination directory is located
- IP: the IP address of the computer where the destination directory is located
The options used are:
- a: archive mode
- v: increase verbosity
- z: compress file data during the transfer
- n: perform a trial run with no changes made
- delete: deletes any files from the destination that are not in the source directory
To test or preview what will happen, run the following from the terminal:
rsync -n -av --delete /SRC/ /DEST/
To syncronise or backup one directory to another directory on the same computer, run the following from the terminal:
rsync -av --delete /SRC/ /DEST/
To syncronise or backup a directory to another computer on the network, run the following from the terminal:
rsync -av --delete /SRC/ USR@IP:/DEST/
Note: To copy files up to another computer you will be prompted for the user's password.
To compress the data during backup, run the following from the terminal:
rsync -avz --delete /SRC/ /DEST/
References and other useful guides:
Go back to the How-to Guides main page.