aptitude update aptitude install rsync
Backup from source to destination
- If you have a directory source, and you want to back it up into the directory destination, do:
rsync -a source/ destination/ or rsync -av source/ destination/
a - archive v - verbose; show more information
Backup over ssh
- Now lets try destination on a remote machine, over a secure shell.
- Make sure source and destination server have rsync installed.
rsync -a -e ssh source/ email@example.com:/path/to/destination/ or rsync -av -e ssh source/ firstname.lastname@example.org:/path/to/destination/
a -archive e -remote shell v -verbose; show more information
rsync does care about the trailing slash, but only on the source argument.
- This means that if you rsync source and destination like this:
Source: source/myfile.txt rsync -a source destination Destination: destination/source/myfile.txt
Source: source/myfile.txt rsync -a source/ destination Destination: destination/myfile.txt
If for example this is second time you are rsyncing the source and destination; you delete a file in source/ and you want it to be deleted in destination/ you will have to use --delete option. The default behavior is to leave the copy at destination/ in place.
rsync -a --delete source/ destination/
a - archive delete - To delete a file in destination if it is not in source
rsync incremental backups
- Backups should be read-only.
rsync always unlinks hard linked files before overwriting
- rsync does backup differently.If today is Friday, the Thursday backup is the "full" backup (always the most recent one) and Monday,T,W have the incremental changes.
rsync way does full backup once, instead of once per week You can't rsync to a tape
- When using deamon mode you can set the public rsync server, or user based rsync server.
- To enable rsync as a deamon you can do the following.
- Set the
- Now you need to create an rsync conf file that will tell rsync server what to share. You can find a sample file in share/doc
cp /usr/share/doc/rsync/examples/rsyncd.conf /etc/rsyncd.conf
- Now start rsync
sudo /etc/init.d/rsync start
- Now see if you can access rsync server. You might need to create /var/www/pub
- You should see:
drwxr-xr-x 4096 2009/06/17 21:55:55 .
- If you get files copied even do they didn't change, and you are mounting via samba, add:
Initially based on: http://www.mikerubel.org/computers/rsync_snapshots/