chiark / gitweb /
1424a3a98abd20043d5a818956cb5a45add8a17f
[chiark-utils.git] / backup / iwjbackup.txt
1 This is a quick summary of IWJ's backup scripts and my config files:
2 it's a bit patchy and might have the odd ommission. The canonical
3 source is the sources, as always :->
4
5
6 WARNING - this file is out of date !
7
8
9 The three tarfiles in this directory should go in the following 
10 places (the paths can probably be configured/hacked, but this is
11 where they are on my system and on chiark):
12
13 etc.tgz : /etc/backup/
14 lib.tgz : /usr/local/lib/backup/
15 var.tgz : /var/local/backup/
16
17 NOTE: these versions are not those used on chiark; they
18 are somewhat modified by me (couple of extra features and
19 lots of comments -- all errors in those are mine.)
20
21 NB: you'll probably need to delete some of the files from
22 var.tgz (in fact, I think you probably don't want any of
23 them except maybe last-tape (which you want to change anyway).
24 You'll also need to recompile readbuffer and writebuffer unless
25 you're using SPARClinux :->
26
27 Contents of /etc/backup/:
28 warnings.*  : files defining how many warnings you get as the
29 system is brought down to do backups. The defaults are fine.
30 settings.pl : generic config file: in particular, the name of 
31 the tape device is set here.
32 tape.*  : each tape you're going to use in the backup cycle
33 has a name and a config file. Here the tapes are named 'a'-'e',
34 although longer names should be OK. You need at least two 
35 tapes defined as the system won't write a backup on the same
36 tape it wrote the last one to.
37
38 Syntax of the tape.* files:
39 filesystems X
40 next N
41 end
42
43 where N is the next tape in the sequence (which should 
44 be circular; I have a->b->c->d->e->a...) and X is a 
45 filesystem-name (list of filesystems might work?).
46
47 Each defined filesystem has a name and a config file
48 fsys.<name>. These files define what is backed up and how.
49 The filesystem 'all' must exist; it's used for incremental
50 backups (and it must exist even if you don't do incrementals).
51 I don't have any other filesystems defined as everything fits
52 on one tape.
53
54 Syntax of these files:
55 Empty lines and lines starting '#' are comments and ignored.
56 Lines starting 'excludedir' given regexps of things to exclude
57 (temp dirs, Netscape's cache, etc). 
58 Lines starting 'prefix' give a command prefix necessary to
59 run things on a remote machine:
60 prefix <prefix-name> <command-part>
61 Other lines should be of the form
62 <directory name>   <backup-type>
63 for local backups, or 
64 <directory name>   <backup-type>   <prefix-name>
65 for remote backups.
66 The file must end with the word 'end' on a line of its own.
67
68 Valid values for <backup-type> are 'cpio' (uses cpio to produce
69 tar-format backups), 'dump' (uses dump to dump entire filesystems;
70 <directory name> should be a mount-point for this), and [if you
71 use my version of the scripts] 'zafio' (uses afio to compress
72 each file as it is backed up). Only 'dump' type backups permit
73 incremental backups.
74
75 Finally, expected-diffs is a config file to indicate which 
76 filesystems should *not* be backed up. The scripts do a config
77 check which involves checking that:
78  * all filesystems to be backed up are present
79  * all filesystems that are present are backed up
80 expected-diffs allows you to make exceptions to this; backing 
81 up your CDROM drive is a bit pointless, frex.
82 The format here is:
83 <prefixchar><mountpoint>
84
85 where <prefixchar> is ?, ! or nothing, and 
86 <mountpoint> is <prefix>:<mountpoint> for a remote fs or
87 <mountpoint> for a local one
88 (examples: "mnementh:/cdrom", "/cdrom").
89 If <prefixchar> is nothing, the scripts will complain if the fs
90 is mounted. If it is !, they will complain if it is not mounted.
91 If ? they won't complain either way (useful for devices that are
92 not always mounted, like /cdrom). '?' is an enhancement only 
93 present in my version of the scripts.
94
95 Useful scripts: (all in /usr/local/lib/backup)
96 checkallused: this only does a check of the configuration files.
97 It should give a cryptic summary of the configuration and print
98 'configuration ok'. If not, fix your config files :->
99
100 loaded: this tells the scripts that a currently unlabelled tape
101 should be treated as tape X: eg:
102 loaded b
103 will cause it to treat it as tape 'b'. [NB: this won't override
104 the TAPEID label written on the tape; it's just for use with
105 previously unused tapes.]
106
107 driver : this is the script to actually run to do a backup.
108 If run from the command line, give it the argument 'test'
109 [otherwise it will attempt to run bringup to change runlevel,
110 on the assumption that it was run from inittab (see below)].
111 You'll need to edit this script to send the status report email
112 to somewhere right for your system.
113
114 takedown : Run this if you want to run a reduced level of system
115 services during backups. Usage:
116 takedown <freq>
117 where <freq> can be 'now', 'soon' or nothing depending on number
118 of warning messages desired. [configured via warnings.* files.]
119
120 To use this you'll need to configure init:
121  * set up runlevel 5 to provide the level of services you want
122    (by tweaking the symlinks in /etc/rc5.d or equivalent)
123  * Add the following to /etc/inittab (tweak paths and VC number
124    if desired):
125
126 # Runlevel 5 is set up to run a reduced level of services during
127 # backups. (currently this means: no squid, no webserver, no newsserver)
128 # We also run the backup script automatically on entering runlevel 5:
129 # (I/O goes to VC 7, which is also the X server, but never mind -- we
130 # very seldom run X anyway :->)
131 dm:5:once:/usr/local/lib/backup/driver </dev/tty7 >/dev/tty7 2>&1
132
133  * takedown can be run from the command line or via cron.
134
135 whatsthis: a simple script I hacked together to display the
136 TAPEID of the current tape and optionally list its contents.
137 Usage:
138 whatsthis [--list [n]]
139
140 WARNING: it's currently hardwired to assume 'cpio' type backups
141 when listing; it could be trivially hardwired to assume 'zafio' 
142 or with slightly more effort it could be done properly :->
143
144 That's all I can think of for now -- comments and 
145 questions to Peter Maydell <pmaydell@chiark.greenend.org.uk>