3 Prev Part I. Installation Next
5 -------------------------------------------------------------------------------
16 XML-conversion;Updates
28 Choosing_an_exclude_mechanism
43 The_ps_command_is_your_friend.
49 Refer to http://www.amanda.org/docs/exclude.html for the current version of
54 There are times when data needs to be excluded from a backup. When these times
55 arise be confident that Amanda has this capability. (Actually it's not Amanda,
56 it's tar.) There are three ways of excluding data in an Amanda backup:
58 * Exclude an individual item explicitly in the dumptype
59 * Utilize an "Exclude List"
60 * Do not include the data in the disklist
62 This document is based on Amanda 2.4.2 and some of this might not work with
63 older versions. This was compiled from my personal experience and with help
64 from the members of the amanda-users mailing list (mailto://amanda-
65 users@amanda.org) when I was originally setting this up, to whom I wish to
66 thank for all of their support.
70 As far as I am able to tell the only way to exclude files or directories with
71 Amanda is to use GNU-tar as the dump program (others?). The file system dump
72 programs provided with unix systems (e.g. dump, ufsdump) get data at a raw
73 drive level and generally do not allow exclusion of specific files or
75 The GNU version of tar, (GNU-tar or gtar), reads its data at a file system, (or
76 higher), level and does include the option to exclude specific files and/or
77 directories. It should be mentioned here that tar will change the access times
78 on files. Tar has the ability to preserve the access times however, doing so
79 effectively disables incremental backups since resetting the access time alters
80 the inode change time, which in turn causes the file to look like it needs to
82 The only exception that I am aware of is to just not include the data in
83 question in the disklist. This option may not be suitable for everyone's needs
84 and can confuse the issue some, so I have elected to include this mechanism in
85 its own section named Do_not_include_the_data_in_the_disklist.
86 For the purpose of this document an Amanda backup configuration named "exclude-
87 test" will be used. The machine that contains the tape drive which receives
88 data to be archived will be referred to as "SERVER". The machine that data is
89 being archived from will be referred to as "CLIENT". These two systems are
90 usually different machines but are not required to be, and may be the same
91 machine. Parts of this setup are on the server and some are on the client.
95 When Amanda attempts to exclude a file or directory it does so relative to the
96 area being archived. For example if /var is in your disklist and you want to
97 exclude /var/log/somefile, then your exclude file would contain ./log/somefile.
98 You may use one exclude file in multiple dumptypes without any restriction.
102 The first step that should be taken is to verify that backups are currently
103 working. Connect to SERVER and run amcheck as your Amanda user, to verify that
104 there are no errors in the current setup.
108 Output should look something like below for success:
110 Amanda Tape Server Host Check
111 -----------------------------
113 /path/to/holding-disk: 4771300 KB disk space available, that's plenty.
114 Amanda Backup Client Hosts Check
115 --------------------------------
116 Client check: 1 host checked in 0.084 seconds, 0 problems found.
118 Next make sure that GNU-tar is the dump program currently in use. The easiest
119 way to tell if your dumptype is using gnutar is to run the following:
121 $ amadmin exclude-test disklist CLIENT
123 Among all the output is the "program" value currently in use. This value is
124 also specified with the "program" option in the dumptype. If the dumptype has
125 the line "program GNUTAR" your setup should be ready to exclude data.
126 If GNU-tar is not in use add the line "program GNUTAR" to the dumptype, and
127 then run amcheck again to verify that backups should work. The capitalization
128 of GNUTAR is required.
129 The dumptype should look something like:
131 define dumptype exclude-test {
132 comment "test dumptype for documentation"
138 Choosing an exclude mechanism
140 If the need is to exclude only one file or directory then the easiest way to
141 accomplish this is to exclude an individual item explicitly in the dumptype. If
142 the need is to exclude multiple files or directories then use an Exclude List.
147 Exclude an individual item explicitly in the dumptype
149 The easiest way to exclude a file or directory is to specify it with the
150 "exclude" option in the dumptype. This option accepts an argument of the file
151 or directory to be excluded. Amanda allows only one exclude option in any
156 UPDATE: Recent Amanda-releases bring the option "exclude append" which enables
157 the administrator to define more than one exclusion-pattern within one dumptype
158 without using a exclude-list. Please look at the amanda.conf.5-manpage for
160 Any path specified to be excluded must be encapsulated with quotes. Continuing
161 with our example from above /var/log/somefile and using the same dumptype as
162 above, the dumptype would now look like:
164 define dumptype exclude-test {
165 comment "test dumptype for documentation"
168 exclude "./log/somefile"
171 Next run amcheck again to verify that there are no problems with the revised
172 Amanda configuration. If the data is not being excluded as expected please see
173 the Troubleshooting section below. This completes the setup of excluding an
174 individual item in the dumptype.
176 Utilize an Exclude List
178 An exclude list is a file that resides on the CLIENT machine and contains paths
179 to be excluded, one per line. This file can be in any location on the CLIENT so
180 long as the same path is specified in the dumptype. Some find /usr/local/etc/
181 amanda an appropriate location, but it is up to you. I personally like to have
182 a subdirectory for exclude files but it is up to you where you place this file.
183 The exclude file may also be placed in the area being archived. This is an easy
184 way to have a different exclusion file for each disklist entry without needing
185 separate dumptype definitions. To use this technique, enter a path relative to
186 the area being archived as the exclude file below instead of an absolute path.
187 Connect to CLIENT and create the exclude directory as root. For example:
189 $ mkdir -p /usr/local/etc/amanda/exclude
190 $ cd /usr/local/etc/amanda/exclude
192 Next create the exclude list for Amanda to use. You can name the exclude file
193 anything you wish it to be. Create a file, and in this file place all paths to
194 files and directories that are to be excluded. Keeping with the /var example,
195 assume that /var/log/XFree86.0.log, and /var/log/maillog need to be excluded.
196 Remember that all paths are relative. The exclude list would look like:
201 Make sure that permissions are restricted on this file. Run the following as
202 root, where exclude-filename is the name of the file you just created. For
205 $ chmod 644 /usr/local/etc/amanda/exclude/exclude-filename
207 This concludes the necessary configuration on the client.
208 Connect to SERVER and cd to the exclude-test Amanda configuration directory.
209 Edit the Amanda configuration file e.g. amanda.conf. Add an entry similar to
210 the following line, to the dumptype for the client in question, where the
211 exclude-filename is the file that was created on CLIENT in the step above
212 including the quotes. For example:
214 exclude list "/usr/local/etc/amanda/exclude/exclude-filename"
216 The new dumptype should look something like:
218 define dumptype exclude-test{
219 comment "test dumptype for documentation"
222 exclude list "/usr/local/etc/amanda/exclude/exclude-filename"
225 Save the file. Run amcheck again to verify that there are no problems with the
226 revised Amanda configuration. If amcheck succeeds then run amdump to verify the
227 data is being excluded correctly. If the data is not being excluded as expected
228 please see the Troubleshooting section below. This completes the setup of an
231 Do not include the data in the disklist
233 Amanda uses disklist entries to define which directories or partitions should
234 be archived. This allows us to exclude data by just not placing the data in
235 question in the disklist. Assume that there is a disk mounted on /example. The
236 directory /example has five subdirectories "a", "b", "c", "d", and "e". The
237 directories "a", "b", and "c" need to be archived, while "d" and "e" should
238 not. This can be accomplished by not specifying "d" and "e" in the disklist.
239 Using the same dumptype and host in the above examples the disklist would
242 CLIENT /examples/a exclude-test
243 CLIENT /examples/b exclude-test
244 CLIENT /examples/c exclude-test
246 Run amcheck to verify that Amanda is working correctly. If the data is not
247 being excluded as expected please see the Troubleshooting section below. This
248 completes the setup of using a disklist to exclude data.
252 Quiz: what is the difference between the following entries in an exclude list?
258 case 1 : directory ./foo won't be in the backup image (that's what you want)
259 case 2 : matches nothing (don't use it) case 3 : directory ./foo will be in the
260 backup image but nothing below it.
264 Amanda has the ability to use wildcard expansion while excluding data as
265 implemented by tar(1). The only places that wildcard expansion is allowed is in
266 the "exclude" option in the dumptype, or in the exclude list. Some simple
268 Exclude any file or directory that ends in ".log" e.g. ppp.log, XFree86.0.log
272 Exclude any file or directory with the string "log" e.g. logfile, maillog,
273 syslog, ppp.log, XFree86.0.log
277 Exclude any file or directory that starts with string "cron" and ends in ".gz"
278 e.g. cron.1.gz, cron.2.gz, log/cron.1.gz
282 The question mark can be used to specify a single character. e.g. log.1, log.2,
290 If you find that you are having trouble getting the exclude patterns to match
291 correctly, check out this really cool script written by John R. Jackson.
292 ftp://gandalf.cc.purdue.edu/pub/amanda/gtartest-exclude
293 This script allows you to test your patterns before placing them in an exclude
294 list or in the dumptype. Instructions on how to run the script are included in
299 There are versions of GNU-tar that do not correctly exclude data. Version 1.12
300 (plus the Amanda patches from http://www.amanda.org) are known to work
301 correctly, as does version 1.13.19 (and later). Anything else is questionable.
305 UPDATE:Using GNU-tar 1.13.25 is recommended.
307 The ps command is your friend.
309 Connect to CLIENT and run a
318 to see exactly how the tar command is running. Look in the output for the --
319 exclude or --exclude-from options in the running tar process. For example:
323 ? R 0:37 /bin/tar --create --directory /var
324 --listed-incremental /var/lib/amanda/gnutar-lists/CLIENTvar_0.new
325 --sparse --one-file-system --ignore-failed-read --totals --file
326 /dev/null --exclude-from=/usr/local/etc/amanda/exclude-test/exclude.var
329 In the above output notice the string "--exclude-from=". The string following
330 the "=" is the exclude file currently in use. If the string was "--exclude"
331 then the string following the "=" is the file or directory that is currently
333 Contact the amanda-users mailing list: mailto://amanda-users@amanda.org.
334 Subscription information is available at http://www.amanda.org.
335 -------------------------------------------------------------------------------
338 Chapter 2. Amanda Installation Notes Home Chapter 4. Indexing with Amanda