NAME
histbackup - backup a directory using an incremental technique
SYNOPSIS
histbackup [options...] [host:]source backupdir [rsyncopts...]
histbackup [options...] --inplace parent [rsyncopts...]
histbackup [options...] --no-rsync parent
DESCRIPTION
histbackup makes incremental backups of a directory tree in a set of directories named by dates, or date-time if the date already exists. The new backup is prepopulated by hardlinks of each file from the previous backup and then updates with rsync(1). This arranges that the only new content of each new backup is fresh copies of the changed files. In this way each backup directory is a full copy of the source directory but the disc space cost is that of an incremental backup. Because it uses rsync, it is possible to efficient backup remote directories in this manner. The companion script histbackup-prune keeps the growth under control.
SETUP AND USE
Before deployment, decide who will own and do the backups. Do all the local (backup end) setup as that user. If you're not a sysadmin then that user is probably yourself.
Generally, setup is as follows:
Create the backup area.
Decide where the backup data will be. Make an empty directory to hold it:
mkdir /path/to/backup/area
Arrange access to the source data
If the data to backup are local to this machine you merely need read access to it. If the data are remote you will need ssh(1) access to the remote host as a user with read access to the data there. Test it:
ssh user@remote ls -l /path/to/source/directory
Perform a test backup
Histbackup does the right thing when the backup area is empty so just:
histbackup -x user@remote:/path/to/source/directory /path/to/backup/area
Schedule your backups
If these backups are to happen regularly a crontab(5) entry should be made to do so. Use ``crontab -e'' to make this. Example:
MAILTO=backup-admin@yoursite
PATH=$PATH:/opt/css/bin
0 * * * * histbackup -x user@remote:/path/to/source/directory /path/to/backup/area
That will run a histbackup every day at midnight, delivering the output of the run by email to backup-admin@yoursite.
Note that cron's environment is very spartan (it does not source /etc/profile or ~/.profile) and so you may need to arrange that the CSS package's environment is present. Also, because cron is a batch situation, your ssh access will almost certainly require a special purpose passphraseless key to access the remote host.
OPTIONS
--inplace
Specify the parent of the source directory; backs up parent/current to parent/datestamp.
--no-delete, --mono
Monotonic growth. Suppresses passing the --delete option to rsync.
--delete
Passed to rsync.
--delete-excluded
Passed to rsync.
--no-rsync, --linkonly
Specify the parent backup directory only and omit the rsync. Emits the backup directory linktree subdirectory name on standard output.
--rsync-path rrsync
Passed to rsync. Specifies the pathname to the remote rsync executable.
--symlink name
After the backup is done, make a symbolic link named name pointing at the latest backup directory. This is useful so that other programs may trivially reference the latest backup without having to figure out its name. Eg: --symlink LATEST.
-v, --verbose
Turn on verbose mode. Also passes -v to rsync.
-P
Passes -P to rsync.
-x
Trace execution of important commands (rsync, linktree etc).
CUSTOMISATION FILE
If the file backupdir/.hbinclude is present the option ``--include-from=backupdir/.hbinclude will be added to the rsync command invocation. In this way the content backed up may be tuned. See rsync(1).
