★ wanayoo — archive 1999 http://www.icce.rug.nl/docs/programs/tob-1.htmlNouvelle recherche | Portail wanayoo
tob: Introduction

1 Introduction

Contents of this section

The tob script which is described in this document is a general driver for the making and maintaining of backups. I wrote this script because I needed a simple-to-use and yet transparent method of making backups, where internal administration would be handled by the method instead of by the operator. The setup of my backup method is directed towards my desires: what tob won't do for you is, e.g., make multi-volume backups to diskettes (I suggest that you take a look at Koen Holtman's (koen@stack.urc.tue.nl) tbackup if this is what you need). I just never make such backups; my method is oriented toward tapes. What tob will do for you, is make full backups, make differential backups (of the files which were changed since the last full backup), make incremental backups (of files changed since all previous backups), let you determine the size of the backup before actually making it, maintain listings of made backups, etc..

The current tob script is probably (almost surely) not perfect. I always welcome feedback; especially when it contains useful suggestions or `working solutions' which I can incorporate. Although I have released tob under GPL `copyleft' conditions, I would appreciate if you have (useful) improvements: please e-mail me your changes and I will incorporate them. The reason is that I'd like to have the ``latest and best'' version too. The current version evolved from such suggestions (thanks, Lars Marowsky-Bree (lmb@pointer.in-minden.de), Rafal Maszkowski (rzm@oso.chalmers.se) and others).

If you like tob, tell your friends about it. If you really like tob, send me a postcard from a far-away place. If you don't like it, tough.

1.1 History

The tob script and its setup is based on the Icmake-driven backup scripts, also by me. I rewrote the scripts to a bash- interpreted form mainly to gain peformance (Icmake interpretation was, alas, significantly slower).

If you are a user of the no longer supported backup scripts, you might want to switch to tob: the installation is easier, and a better configurability is possible. The volume definition files which the backup scripts introduced can (with slight modifications) be used for tob.

History:

1.2 Backups, general information

Before describing the installation and usage of tob, a few general notes about backups are in order.

The backup program

A backup is always created (or restored) using a backup program, also called the archiver. The choice of the backup program can be quite important: some programs produce more error-prone backups than others.

Typical backup programs for Unix environments are cpio, tar and the newer afio. cpio is a program which accepts a list of files on stdin and copies these files to a backup device. The list of files is typically constructed with the program find. A disadvantage of cpio is that the files are not written in compressed format.

tar, the `Tape ARchiver', generates a list of files itself and writes the files to a backup device. Newer versions of tar support the -z flag, which specifies that the data stream is filtered through a compression program (typically gzip) before it is sent to the backup device. An advantage of this method is, obviously, that the backup is smaller. An important disadvantage is the fact that the entire backup is compressed, from the first byte to the last. If the backup medium develops a fault (e.g., a bad sector on a diskette or a tape) then the entire backup beyond the fault becomes unreadable: as this section cannot be uncompressed, the files in it cannot be identified.

The last backup program which is described here is afio. This program is in its usage similar to cpio, except that it supports a -z flag which instructs it to filter individual files through a compression program. The final backup then consists of afio's uncompressed headers and compressed data. Using this approach, afio presents `the best of two worlds': compressed backups which however are not too error-prone. When a fault develops on the backup medium, afio can skip the invalid data until it encounters a new header; files beyond the fault can still be accessed. afio 2.4.0 seemed to malfunction while restoring symbolic links (thanks, Berthold Crysmann (crysmann@rrz.uni-hamburg.de)), but 2.4.1 looks all right.

The tob setup includes a number of sample definition files, which select compressed tar backups, uncompressed tar backups or compressed afio backups. The tob package somewhat shows my preferences for afio, as this is the default setting.

Full, differential and incremental backups

Backup types are often described as full, differential or incremental backups. A full backup consists of all files of a given set.

A differential backup consists of all files of a set which were changed since the last full backup. The tob package selects files for a differential backup using a ``hungry'' approach: files are considered `changed' not only by date comparison, but also by comparing size information, inode information etc.. This means that when two files are swapped, as in

 # swap two files /etc/a and /etc/b
 mv /etc/a /tmp/x
 mv /etc/b /etc/a
 mv /tmp/x /etc/b

tob will (correctly) flag these files as `changed' and select them for a differential backup. Compare this to an approach in which `differential' backups consist only of files that are newer than a certain date: those backups would not include two swapped files.

This setup of different types of backups means that tob has to maintain lists of backed up files. These lists are kept in a compressed format. Tob keeps one file of each type (one listing of the last full backup, one listing of the last differential backup and listings of incremental backups). This approach has the following philosophy in mind: when a full backup is created, all files are saved on a backup medium. A listing of the previous full backup therefore becomes obsolete; why restore files from a stale full backup when a more recent version exists? The same reasoning holds true for differential backups; only the most recent one should be used when restoring files. Therefore, by definition, only one version of the last full or differential backup may exist since this version is the most recent. Tob automatically keeps only the last listings of a full or differential backup, all other listings are automatically deleted. Once a full and a differential backup is present, all files can be restored from these two backups.

Incremental backups are a tad more difficult. Incremental backups are defined as consisting of all files which are changed since all previous backups: be it full, differential or incremental. Typically, incremental backups are made more frequently than the other types and are stored each on their own medium. Tob maintains a listing for each incremental backup ever made, until a full or differential backup is scheduled. A possible backup scheme is the following:

The choice of the `ideal' backup schedule of course depends on the setup. I for myself just make full backups, because all files on my Linux partition fit on one tape. I hardly ever make differentials; let alone incrementals.

1.3 Obtaining and tob

The tob script, its documentation and sample definition (resource) files can be obtained at the ftp site ftp.icce.rug.nl. An archive tob-X.YY.tar.gz is located in the directory pub/unix, where X.YY is a version number (e.g., 0.13).

Please don't mail me with questions or bug reports about tob unless you have checked on ftp.icce.rug.nl. It is very well possible that a `bug-repaired' archive of tob is present on the primary site. If you do find a bug in the latest version, then of course please do mail me.

The tob archive may furthermore be found at the `standard' Linux sites sunsite.unc.edu and tsx-11.mit.edu. These sites also carry the backup program afio.

1.4 Known quirks

The current tob setup knows only one bug (thanks, Warwick Allison (warwick@cs.uq.oz.au) and Peter Mutsaers (plm@atcmp.nl), also for other bug reports and countless improvements).

The bug is the fact that an empty .exclude file (see section ) for a given volume will exclude everything, thereby effectively scheduling an empty backup. Given the knowledge of this bug, just make sure that if you don't want to exclude files from a backup, don't create a .exclude file.

Since this behavior is now documented, it's no longer a bug but a quirk. Maybe even a feature. So there you are.

Another previous bug is now fixed (thanks, Peter): files with spaces in the names are now handled correctly. Furthermore, older versions of tob restored directories with wrong permissions, that's fixed too (thanks, Jeff Coy Jr.).

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter