rsbackup(1) | General Commands Manual | rsbackup(1) |
rsbackup - rsync-based backup utility
rsbackup [OPTIONS] [--] [SELECTOR...]
rsbackup --retire [OPTIONS] [--] [SELECTOR...]
rsbackup --retire-device [OPTIONS] [--]
DEVICE...
rsbackup backs up files from one or more (remote) destinations to a single backup storage directory, preserving their contents, layout, ownership, permissions, timestamps and hardlink structure.
Incremental backups are achieved by hard-linking identical files within successive backups of the same files.
See rsbackup(5) for details of the configuration file.
At least one of these options must be specified. When multiple actions are specified, they are executed in the order shown below.
The list of selectors on the command line determines what subset of the known volumes are backed up, pruned or retired. The following selectors are possible:
If no hosts or volumes are specified on the command line then all volumes are selected for backing up or pruning. For retiring, you must explicitly select hosts or volumes to retire and only positive selections are possible.
To add a new host create a host entry for it in the configuration file.
To back up the local host, specify hostname localhost. Otherwise you can usually omit hostname.
You may want to set host-wide values for prune-parameter prune-age, max-age and prune-parameter min-backups.
A host with no volumes has no effect.
To add a new volume create a volume entry for it in the relevant host section of the configuration file.
Add exclude options to skip files you don't want to back up. This might include temporary files and the contents of "trash" directories.
If the volume contains mount points, and you want to back up the contents of the subsiduary filesystems, then be sure to include the traverse option.
You may want to set per-volume values for prune-parameter prune-age, max-age and prune-parameter min-backups.
To add a new device, format and mount it and create a device-id file in its top-level directory. Add a device entry for it in the configuration file and a store entry mentioning its usual mount point.
Under normal circumstances you should make sure that the backup filesystem is owned by root and mode 0700.
To backup up all available volumes to all available devices:
rsbackup --backup
You will probably want to automate this. To only back up a limited set of volumes specify selection arguments on the command line.
To prune old backups:
rsbackup --prune --prune-incomplete
You will probably want to automate this.
An "incomplete backup" occurs when a backup of a volume fails or is interrupted before completion. They are not immediately deleted because rsync may be able to use the files already transferred to save effort on subsequent backups on the same day, or (if there are no complete backups to use for this purpose) later days.
Retiring a host means removing all backups for it. The suggested approach is to remove configuration for it and then use rsbackup --retire HOST to remove its backups too. You can do this the other way around but you will be prompted to check you really meant to remove backups for a host still listed in the configuration file.
If any of the backups for the host are on a retired device you should retire that device first.
Retiring a volume means removing all backups for it. It is almost the same as retiring a whole host but the command is rsbackup --retire HOST:VOLUME.
You can retire multiple hosts and volumes in a single command.
Retiring a device just means removing the records for it. Use rsbackup --retire-device DEVICE to do this. The contents of the device are not modified; if you want that you must do it manually.
You can retire multiple devices in a single command.
Restore costs extra l-)
The backup has the same layout, permissions etc as the original system, so it's perfectly possible to simply copy files from a backup directory to their proper location.
Be careful to get file ownership right. The backup is stored with the same numeric user and group ID as the original system used.
Until a backup is completed, or while one is being pruned, a corresponding .incomplete file will exist. Check for such a file before restoring any given backup.
Supposing that host chymax has a volume called users in which user home directories are backed up, and user rjk wants their entire home directory to be restored, an example restore command might be:
rsync -aSHAXz --numeric-ids /store/chymax/users/2010-04-01/rjk/. chymax:~rjk/.
You could add the --delete option if you wanted to restore to exactly the status quo ante, or at the opposite extreme --existing if you only wanted to restore files that had been deleted.
You might prefer to rsync back into a staging area and then pick files out manually.
You could tar up a backup directory (or a subset of it) and then untar it on the target. Remember to use the --numeric-owner option to tar.
A store may be in the following states:
The states are recognized using the following tests (in this order):
backups.db is a SQLite database. It contains a single table
with the following definition:
CREATE TABLE backup (
host TEXT,
volume TEXT,
device TEXT,
id TEXT,
time INTEGER,
pruned INTEGER,
rc INTEGER,
status INTEGER,
log BLOB,
PRIMARY KEY (host,volume,device,id) )
Each row represents a completed backup. The meanings of the fields are as follows:
Possible status values are:
rsbackup is not designed with concurrent access to this table in mind. Therefore it is recommended that you only modify its contents when the program is not running.
Older versions of rsbackup stored the logs for each backup in a separate file. If such files are encountered then rsbackup will automatically populate backups.db from them and then delete them.
Older versions of rsbackup logged pruning information to a pruning logfile. These files will be deleted at the same rate as records of pruned backups in the database. They are not included in the report.
rsbackup-graph(1), rsbackup.cron(1), rsbackup-mount(1), rsbackup-snapshot-hook(1), rsync(1), rsbackup(5)
Richard Kettlewell <rjk@greenend.org.uk>