Snapback2 does backup of systems via ssh and rsync. It creates rolling "snapshots" based on hourly, daily, weekly, and monthly rotations. When it runs for some period of time, you will end up with a target backup directory that looks like:

You might think this would take up lots of space. However, snapback2 hard-links the files to create the images. If the file doesn't change, only a link is necessary, taking very little space. It is possible to create a complete yearly backup in just over 2x the actual storage space consumed by the image.

This specifies the host computer which will be backed up, and it is given an internet address as a parameter (host name or IP address). Only one block can be specified per hostname per configuration file, but it is possible to make the parameter a pseudo-host by overriding the address with the BackupHost directive.

This is contained within a Backup block, and is an alternate method of specifying a Directory. The parameter is the directory name. The use for this is specifying different backup parameters for that directory only.

If set to yes, which is the default, the time of the previous backup is checked and backup is only done if appropriate. The formula for checking appropriateness is:

(24 / Hourlies - 0.5) * 60 * 60 < now - mtime

where Hourlies is the value of the Hourlies directive, now is the current time in seconds since 1970, and mtime is the modification time in seconds since 1970.

For example, if Hourlies is set to 4 and the script is called every hour, it will only run the backup if the timestamp of the latest hourly backup is more than 5.5 hours old. Obviously this means your backup should take less than an hour to complete; if you have an extremely extensive backup setup that could exceed an hour you will want to break it up into separate runs or make the script call frequency greater.

where YYYYMMDD is the date in quasi-ISO format and N is the number of bytes read. This allows monitoring of bandwidth used for a particular backup host, possibly for a bandwidth-based charging mechnism.

Unless RsyncVerbose is set, also sets the --stats option so that transfer statistics can be captured.

The destination directory for the backup. A subdirectory of the host address is created (providing CreateDir is yes, the default), and then the first part of the Directory is created. The hourly/daily/weekly directories are then maintained there.

If the backup target has a large number of files, the backup system overhead to remove the outdated backup directory and hard-link the new backup directory will be considerable.

This option, when set to Yes in the Backup container (or globally) will cause the outdated backup directory to be moved to the prospective next backup directory. Rsync then operates on that directory, and while transfer bandwidth might be greater, overall system overhead will be much less.

To set in your snapback.conf:

ManyFiles Yes

Once again, this is usually in the individual backup container.

The ManyFiles directive is not compatible with RetainPermissions and sets it off if active.

You should choose this option when you have a large number of small files and you don't have an overriding need to retain ownership and permissions on the old backups.

A shell command which is run to determine whether the target host is up and running. A true (zero) exit status indicates that backup should be done, a non-true exit status indicates that the backup should be skipped.

The following strings are substituted for:

%h Host name of backup
%d Directory name being backed up
%c Client name

Normally snapback2 changes the permissions and ownership of backed-up files in the newest backup to match the current state of the file system. Should you need to restore an earlier backup, those settings might have been changed.

When RetainPermissions is active, the rsync program will be called with the --link-dest option (providing there is a previous backup to link to). It will not link files where ownership and permissions have changed. It will copy locally and change the permissions.

This is the default, and to turn it off you must set:

RetainPermissions No

This option is automatically turned off when ManyFiles is set, and this is the main time you will not want RetainPermissions active. It is recommended that you keep the default.

Normally snapback2 creates a temporary file named /tmp/rsyncNNNNN, where NNNNN is the process ID. This parameter passes a log file to use instead. It will be created if it does not exist, and appended to if it does.

This script is heavily cribbed from the original snapback done by Art Mulder. Some of the routines, particularly do_rotate() and do_backup(), are much the same; the main program flow and configuration is completely redone.