Rsbackup backup Users Guide

From LinuxServerTech

Jump to: navigation, search


rsync_backup is an application that has grown out of the backup service scripts designed and implemented by Daily Data to meet the needs of a reliable backup service for our clients. rsync_backup is the client for this suite that can be used without the server portion if desired.

Contents

Acquiring rsync_backup

rsync_backup is available in either source form (Perl Script) or as a Debian Package.

Source

I'm still working on this. Check back in a day or two rod, 20080626

Daily Data Debian Repository

We have a trivial repository set up for this package, and intend to add additional packages as the become mature (rsync_backup has been developed over a period of three years, and is currently deployed on several servers, so we consider it mature). Add the following to /etc/apt/sources.list for access to this repository:

#
# Daily Data Repository
#
deb     http://debian.dailydata.net/debian_repository /

Obviously, the comments are not necessary.

Afterwards, execute the following commands to download and install rsync_backup:

apt-get update
apt-get install rsync-backup

All of our documentation to date has been in html or internal, so the man pages are not quite up to speed.

This will install three non-documentation files:

/etc/rsync_backup/rsync_backup.conf  -- main configuration file; edit this
/etc/cron.d/rsync_backup             -- cron control; modify to set the time and error notification
/usr/sbin/rsync_backup               -- executable

all set with defaults. The latter (the executable) is hopefully unlikely to require modification, but feel free to do so. If you find changes that help, contact us and we'll be happy to review it for inclusion. One item waiting to be done is the execution of arbitrary code prior to the actual processing; mounting drives is the current drive behind that.

You can change the cron file if you want the process executed on a different schedule than the default -- 1am every morning -- or the recipient of errors which is set to root by default.

You should definitely edit /etc/rsync_backup/rsync_backup.conf. While it makes some logical assumptions for the default configurations, it would be highly unlikely that all of them are correct in most cases. The configuration file is pretty well documented, so I'll not waste time on it here.

Note: the configuration file is backwards compatible, so computers which used previous versions that had configuration files (look for /root/bin/backup.conf) can simply copy those files to /etc/rsync_backup/rsync_backup.conf, though the new configuration file format is much better laid out and commented.

Testing the Installation

In the configuration file, the first definition is:

$TEST_CONDITIONS = 1;

which puts the program in test mode. With this in place, execute the program by entering the command rsync_backup from the command line. No actions will be taken, but the commands that would be normally executed are printed on stdout. You can review them for correctness. After you are satsified with the results of this test, change the line to read:

$TEST_CONDITIONS = 0;

To do a dry run of the backup, ensure the following line reads

 $CONTROL{'--dry-run'} = sub { return 1; } ;

which will cause an rsync dry run to be executed. All commands are executed except files are not actually transferred to the destination. Depending upon connection speed, processor speed, and the number of files, this can take from a few seconds to, literally, hours. For a test run, you might also modify the @DIRS_TO_BACKUP array, removing all but a small directory, such as /etc:

@DIRS_TO_BACKUP = ('/etc'); 

At this point, move to the root directory (or any user directory) and run rsync_backup. I generally place it in the background as follows:

cd /root
nohup rsync_backup &

which will run the program in the background even if you log off the machine. To watch the progress of the program, you can watch the log file as it grows. It is, by default, located in /root/backup_logs/ and have a name of the form yyyymmdd_computer.name.backup.log while rsync is running. Thus, the following command allows you to watch the progress:

tail -f /root/backup_logs/yyyymmdd_computer.name.backup.log

where yyyymmdd is the current date, and computer.name is the name of your computer (or whatever you changed the variable $MY_NAME to in the configuration file).

Once the script is done, this file will be gzipped, and you will see no further action on the log file (it will have disappeared).

If anything goes wrong, fix it and try again. Generally, the problem is with ssh.