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:
#
, these are commentsnot
instructions which cause files to be
excluded from the backup process.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.
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
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.
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.
not
instructions all take shell patterns as arguments.
These patterns can contain the following special constructs:
*
: matches any sequence of zero or more characters
(the sequence may contain /
characters)?
: matches any single character[...]
: matches any of the enclosed characters[b-f]
: matches the range b
, c
,
d
, e
, and f
[ˆ...]
: matches all characters but ...
c
: matches the character c
, mainly used to specify the special characters
* ? [ ] ˆ \
and -
if it appears between
[ ]
.
/tmp/tbup
or the proc filesystem /proc
.
If your directory set lists /
as the directory to back up,
you can do this by putting
not dir /tmp
not dir /proc
in the directory set configuration file. Backing up the proc
filesystem wastes space, and a restore of an archive including
/tmp/tbup
will almost certainly fail.
The contents of the directory /tmp/bulkdir
(or whatever
bulkdir
you have configured in the /etc/tbackup/Config
file) are always excluded automatically from all backup sets. This
way you won't have to update directory set files if you relocate this
temporary directory by editing /etc/tbackup/Config
.
not dir
instruction is a bit inefficient. When
backing up the set
/usr/X386
not dir /usr/X386/lib/fonts
tbackup will look at all files in /usr/X386/lib/fonts
before deciding
it doesn't need them. This takes a few seconds, but as tbackup is
usually waiting for the floppy drive anyway this doesn't matter much.
There is however a special optimization to prevent tbackup
from looking at all files on (say) a cdrom filesystem mounted
as /cdrom
, as that would take many minutes, not seconds.
For example, with the following set the files on the cdrom drive and the
dos partitions will never be looked at:
#back up everything under / except the cdrom and dos partitions
/
#but don't back up the cdrom drive
not dir /cdrom
#and the msdos partitions
not dir /dosc /dosd
#other stuff not to include
not dir /tmp /proc
not dir /usr/*/fonts
not name core
The special optimization works if /
is the only entry in the
set file apart from not
instructions. If this is the case, all
directories directly under /
that are specified in not
dir
instructions will not be looked at.
Tbackup has three directory set instructions not covered above. You may want to use these instructions in special cases.
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
/
.
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 testexcludes 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 testonly 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.
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