7 Configuring directory sets

Contents of this section

A directory set named foo is made by putting a configuration file called foo.set in the directory /etc/tbackup. This file can be made with a normal editor, but also with the tdir command. The tdir command is mainly useful for making temporary directory set files, we will cover it in Section freespace (Freeing harddisk space) below.

The presence of a file /etc/tbackup/foo.set causes the directory set to be listed as

1    foo        # a set called foo
Where the \# a set called foo part is the first line of the foo.set file.

A *.set file may contain:

Here is an example foo.set file:

# a set called foo
 
#these are the directories in the set
/usr/foo
/usr/src/foo

# some things not to back up: no files named `core'
not name core
# and no files with the extensions .aux and .dvi
not ext .aux .dvi

#don't back up this subdirectory
not dir /usr/foo/pux/tmp

A backup set consists of all files in the specified directories and their subdirectories, minus the files that are excluded by not instructions. Do not put the same directory name twice in a .set file, this will cause it to be included twice in the archive.

A full backup of a directory set backs up all files in the set. Symbolic links are not followed but stored as symbolic links.

An incremental backup of a directory set backup up all files in the set that were created or changed since the last (full or incremental) backup.

7.1 Examples

Some examples of .set files can be found in /usr/lib/tbackup/examples.

Here is the file system.set from this directory:

# root filesystem, without /root dir.
 
/
 
#these are in other sets, no not back them up.
not dir /c
not dir /ext
not dir /root
 
#exclude temporary files and the /proc filesystem.
not dir /tmp
not dir /proc

not name core

7.2 Trying out a directory set file

If you have made a directory set file, you can `test' it by trying to make a backup of the directory set with the tbackup command.

A faster way to try out a directory set file is to use the tguess command to guess the size of the directory set. Tguess can also produce a guess index listing all files in the directory set. See Section tguess (Running tguess) for more information on running the tguess command.

7.3 `not' instructions

Below are the available not instructions for excluding files from a directory set.

not name n1 n2 ...

Exclude all files named n1, n2, ... from the set.

Examples:

not name core excludes all core files.

not name a*.log excludes all files matching this shell pattern.

not ext e1 e2 ....

Exclude all files whose names end with e1, e2, ... from the set. (ext stands for extension)

Examples:

not ext .o excludes all object files.

not ext o excludes all files ending with an o

not ext .aux .log .dvi excludes temporary TeX files.

WARNING: Do not use `not ext .o' for the directory set containing the /usr/lib directory: this would cause the files /usr/lib/crt0.o and /usr/lib/gcrt0.o to be excluded from the backup. If these files are missing after a restore, gcc can't compile any programs.

not dir d1 d2 ....

Exclude all files in the directories d1, d2, ... and the directories below from the set, where d1, d2, ... are full directory names starting with a /.

Examples:

not dir /usr/tmp excludes this temporary directory.

not dir /usr/man/man[567] /usr/man/cat[567] excludes all manual pages from sections 5,6, and 7.

Note: The set

/usr/src
not dir /usr/src/linux
/usr/src/linux/boot
does NOT contain the files in /usr/src/linux/boot! The not dir instruction is applied to all (sub)directories in the set, so the /usr/src/linux/boot line has no effect at all.

not fullname f1 f2 ....

Exclude the files f1, f2, ... from the set, where f1, f2, ... are full pathnames starting with a /.

Examples:

not fullname /usr/lib/dutch.hash excludes this file from the set.

not fullname /usr/src/linux/*.[oa] excludes all .o and .a files in the /usr/src/linux directory and below.

The above not instructions all take shell patterns as arguments. These patterns can contain the following special constructs:

7.4 Potential problems

7.5 Special directory set instructions

Tbackup has three directory set instructions not covered above. You may want to use these instructions in special cases.

The setroot instruction

In the normal case, all directory and file names in a set are relative to /, the file system root directory. You can change this with the

setroot directory
instruction. This instruction tells tbackup that all names in the set should be treated as relative to the directory. For example, the directory set

#back up /home on some.other.box via NFS

#mountpoint of remote filesystem
setroot /nfsmounts/an.other.box

/home

#do not back up files of user ftp.
not dir /home/ftp

will back up the

/nfsmounts/an.other.box/home

directory on the local machine, excluding the

/nfsmounts/an.other.box/home/ftp

directory. In the archive produced, the file names will be relative to /nfsmounts/an.other.box/, meaning that they will be named

home
home/albert
home/albert/.bashrc
 [etc]

and not

/nfsmounts/an.other.box/home
/nfsmounts/an.other.box/home/albert
/nfsmounts/an.other.box/home/albert/.bashrc
 [etc]

This relative naming can be convenient when restoring the archive on an.other.box itself, where it can be unpacked relative to /.

The expert directory set instructions

With these two instructions them you can `hack' the directory set mechanism to do special things. They are called `expert instructions' because tbackup does not provide any error checking or error recovery for them.

Tbackup uses the UNIX find command internally when determining the contents of directory sets. With the two expert instructions you can influence this find command directly.

The instructions are:

not findtest find test

excludes all files that make the find test predicate true. See the find manual page for a description of the find tests supported by find.

Example:

not findtest -type p excludes all files with type p, that is named pipes, from the backup.

findtest find test

only include files that make the find test true.

Examples:

findtest -user root only backs up the files owned by root

findtest -cnewer /etc/installdate only includes the files that were created or last modified after the ls -l date of /etc/installdate. (I made a /etc/installdate just after installing a slackware distribution from scratch. On my machine, this instruction thus excludes all files that came from the slackware floppies.)

findtest -xdev causes find not to cross filesystem borders when descending into subdirectories.

Always test a directory set with a findtest instruction: the instruction may sometimes have unexpected results.

If you use wildcards in find tests, you must quote them as you would in the shell, for example

not findtest -lname '/tmp/*'

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter