Random Projects: Rsync Backup

These are a few random projects. They range from very useful to totally frivolous. Consider them all to be under the GPL.

This document describes the rsync backup system.  
It is based on a script I found the rsync.org home page, 
and is distributed under the GNU Public License

Brian Hone 3/24/2002


This is a script which can be used as a full-featured backup system.  
It can back up any system which it can rsync, that includes:

o Regular Filesystem
o Rsync protocol
o Rsync via ssh 

Basic behavior:

1. Every time the script is run, it uses the rsync protocol to generate 
a list of data to copy/delete from the data directory to the archive/main 
2. Before overwriting/deleting any files from the main backup directory, 
it copies them to archive/yyyy-mm-dd.

Why this is so useful:

1. You can archive to cheap disk.  Disk is now so cheap that in many cases, 
it's cheaper to just backup to a big raid partition.  It's a fairly simple 
matter to swap disks out every few months for offsite backup.
2. You can search and restore data very easily.  Using filesystem search tools, 
such as linux's 'locate' command, it's very fast to generate a list of files 
to recover.
3. Recovery is as fast as copying files.  Tape recovery is very very slow.
4. Your backup server becomes an emergency failover for your main fileserver.  
If your using samba or nfs, you can easily turn your backup fileserver on 
should your main fileserver fail.


1. If you're using filesystem backup (including SMB and NFS), set up your 
backup server to mount your main fileserver.
	- NB: Make sure the user you run this script as has read permission to 
	  these files.  If you use NFS, for example, you'll probably want 
	  to configure /etc/exports on your main fileserver something like:
			backup_server(ro, no_root_squash)	
	  That gives the backup server the ability to read all the files in that
	  path as root, but it's read only.  You can set up samba similarly.

   If you want to use the rsync daemon or ssh as your file transfer protocol, 
you'll have to modify $OPTIONS accourdingly.

2. Edit the variables in the top portion of rsync_script.sh
3. Set it up to run each night -
	You can do this either by putting it into /etc/cron.daily or by typing 
	'crontab -e' and adding the following line:

	0 0 * * * /bin/sh 	


1. Include options for ssh and rsyncd backup
2. Write a good restore script
3. Maybe if people start using this, we'll want a web interface.