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