Imported Upstream version 2.5.2p1
[debian/amanda] / docs / using.txt
1
2             Chapter 18. Using Amanda
3 Prev  Part IV. Various Information  Next
4
5 -------------------------------------------------------------------------------
6
7 Chapter 18. Using Amanda
8
9
10 John R. Jackson
11
12 Original text
13 AMANDA Core Team
14 <jrj@purdue.edu>
15
16 Gavin Henry
17
18 XML-conversion
19 Suretec Systems Ltd.
20 <ghenry@suretecsystems.com>
21
22 Stefan G. Weichinger
23
24 XML-conversion, Updates
25 AMANDA Core Team
26 <sgw@amanda.org>
27 Table of Contents
28
29
30   An_Introduction
31
32   Amanda_Features
33
34   Future_Capabilities_of_Amanda
35
36   Amanda_Resources
37
38   Installing_Amanda
39
40
41         Install_Related_Packages
42
43         Perform_Preliminary_Setup
44
45         Configure_the_Amanda_Build
46
47         Build_and_Install_Amanda
48
49         Configuring_Amanda
50
51         Decide_on_a_Tape_Server
52
53         Decide_Which_Tape_Devices_to_Use
54
55         Decide_Whether_to_Use_Compression
56
57         Decide_Where_the_Holding_Space_Will_Be
58
59         Compute_Your_Dump_Cycle
60
61         Copy_and_Edit_the_Default_Configuration_File
62
63         Configure_the_Holding_Disk
64
65         Configure_Tape_Devices_and_Label_Tapes
66
67         Configure_Backup_Clients
68
69         Test_and_Debug_Setup
70
71
72   Operating_Amanda
73
74
75         Run_amdump
76
77         Read_Amanda's_Reports
78
79         Monitor_Tape_and_Holding_Disk_Status
80
81         Adding_Tapes_at_a_Particular_Position_in_the_Cycle
82
83         Miscellanous_Operational_Notes
84
85
86   Advanced_Amanda_Configuration
87
88
89         Adjust_the_Backup_Cycle
90
91         Adjust_Parallelism
92
93         Monitor_for_Possible_Improvements
94
95         Excluding_Files
96
97
98   Restoring_with_Amanda
99
100
101         Configuring_and_Using_amrecover
102
103         Using_amrestore
104
105         Restoring_Without_Amanda
106
107
108
109 An Introduction
110
111
112 Note
113
114 This chapter was written by John R. Jackson with input from Alexandre Oliva. It
115 is part of the O'Reilly book "Unix Backup & Recovery" by W. Curtis Preston and
116 has been provided online at http://www.backupcentral.com/amanda.html since the
117 first edition of this book.
118 During the Docbook-conversion of the Amanda-docs we asked for permission to
119 include this chapter in the Official Amanda documentation and W. Curtis Preston
120 allowed to us to include the now converted version. There will be some updates
121 to this chapter in the next few months to reflect various changes and
122 enhancements.
123 You can find online versions of this chapter at http://www.amanda.org/docs/
124 using.html and at http://www.backupcentral.com/amanda.html.
125 Amanda, the Advanced Maryland Automated Network Disk Archiver, is a public
126 domain utility developed at the University of Maryland. It is as advanced as a
127 free backup utility gets, and has quite a large user community. Amanda allows
128 you to set up a single master backup server to back up multiple hosts to a
129 single backup drive. (It also works with a number of stackers.) Amanda uses
130 native dump and/or GNU-tar, and can back up a large number of workstations
131 running multiple versions of Unix. Recent versions can also use SAMBA to back
132 up Microsoft Windows (95/98/NT/2000)-based hosts. More information about Amanda
133 can be found at http://www.amanda.org
134 Amanda was written primarily by James da Silva at the Department of Computer
135 Science of the University of Maryland around 1992. The goal was to be able to
136 back up large numbers of client workstations to a single backup server machine.
137 Amanda was driven by the introduction of large capacity tape drives, such as
138 ExaByte 8mm and DAT 4mm. With these drives, and the increased number of
139 personal workstations, it no longer made sense to back up individual machines
140 to separate media. Coordinating access and providing tape hardware was
141 prohibitive in effort and cost. A typical solution to this problem reaches out
142 to each client from the tape host and dumps areas one by one across the
143 network. But this usually cannot feed the tape drive fast enough to keep it in
144 streaming mode, causing a severe performance penalty.
145
146 Note
147
148 Since Amanda is optimized to take advantage of tape drives, we will use the
149 word tape throughout this section. However, that doesn't mean that you couldn\19t
150 use it with an optical or CD-R drive.
151 The Amanda approach is to use a "holding disk" on the tape server machine, do
152 several dumps in parallel into files in the holding disk, and have an
153 independent process take data out of the holding disk. Because most dumps are
154 small partials, even a modest amount of holding disk space can provide an
155 almost optimal flow of dump images onto tape.
156 Amanda also has a unique approach to scheduling dumps. A "dump cycle" is
157 defined for each area to control the maximum time between full dumps. Amanda
158 takes that information, statistics about past dump performance, and estimates
159 on the size of dumps for this run to decide which backup level to do. This gets
160 away from the traditional static "it's Friday so do a full dump of /usr on
161 client A" approach and frees Amanda to balance the dumps so the total run time
162 is roughly constant from day to day.
163 Amanda is freely-available software maintained by the Amanda Users Group. Based
164 on membership of Amanda-related mailing lists, there are probably well over
165 1500 sites using it. This chapter is based on Amanda version 2.4.2. Updated
166 versions of this section will be available with the Amanda source code.
167
168 Amanda Features
169
170 Amanda is designed to handle large numbers of clients and data, yet is
171 reasonably simple to install and maintain. It scales well, so small
172 configurations, even a single host, are possible. The code is portable to a
173 large number of Unix platforms. It calls standard backup software, such as
174 vendor provided dump or GNU-tar, to perform actual client dumping. There is
175 also support for backing up Windows-based hosts via SAMBA. There is no
176 Macintosh support yet.
177 Amanda provides its own network protocols on top of TCP and UDP. It does not,
178 for instance, use rsh or rdump/rmt. Each client backup program is instructed to
179 write to standard output, which Amanda collects and transmits to the tape
180 server host. This allows Amanda to insert compression and encryption and also
181 gather a catalogue of the image for recovery. Multiple clients are typically
182 backed up in parallel to files in one or more holding disk areas. A separate
183 tape writing process strives to keep the tape device streaming at maximum
184 throughput. Amanda can run direct to tape without holding disks, but with
185 reduced performance.
186 Amanda supports using more than one tape in a single run, but does not yet
187 split a dump image across tapes. This also means it does not support dump
188 images larger than a single tape. Amanda currently starts a new tape for each
189 run and does not provide a mechanism to append a new run to the same tape as a
190 previous run, which might be an issue for small configurations.
191 Amanda supports a wide range of tape storage devices. It uses basic operations
192 through the normal operating system I/O subsystem and a simple definition of
193 characteristics. New devices are usually trivial to add. Several tape changers,
194 stackers, and robots are supported to provide truly hands-off operation. The
195 changer interface is external to Amanda and well-documented, so unsupported
196 changers can be added without a lot of effort.
197 Either the client or tape server may do software compression, or hardware
198 compression may be used. On the client side, software compression reduces
199 network traffic. On the server side, it reduces client CPU load. Software
200 compression may be selected on an image-by-image basis. If Kerberos is
201 available, clients may use it for authentication and dump images may be
202 encrypted. Without Kerberos, .amandahosts authentication (similar to .rhosts)
203 is used, or Amanda may be configured to use .rhosts (although rsh/rlogin/rexec
204 are not themselves used). Amanda works well with security tools like TCP
205 Wrappers (ftp://info.cert.org/pub/network_tools) and firewalls.
206 Since standard software is used for generating dump images and software
207 compression, only normal Unix tools such as mt, dd, and gunzip/uncompress are
208 needed to recover a dump image from tape if Amanda is not available. When
209 Amanda software is available, it locates which tapes are needed and finds
210 images on the tapes.
211 Amanda is meant to run unattended, such as from a nightly cron job. Client
212 hosts that are down or hung are noted and bypassed. Tape errors cause Amanda to
213 fall back to ?degraded? mode where backups are still performed but only to the
214 holding disks. They may be flushed to tape by hand after the problem is
215 resolved.
216 Amanda has configuration options for controlling almost all aspects of the
217 backup operation and provides several scheduling methods. A typical
218 configuration does periodic full dumps with partial dumps in between. There is
219 also support for:
220
221 * Periodic archival backup, such as taking full dumps to a vault away from the
222   primary site.
223 * Incremental-only backups where full dumps are done outside of Amanda, such as
224   very active areas that must be taken offline, or no full dumps at all for
225   areas that can easily be recovered from vendor media.
226 * Always doing full dumps, such as database areas that change completely
227   between each run or critical areas that are easier to deal with during an
228   emergency if they are a single-restore operation.
229
230 It's easy to support multiple configurations on the same tape server machine,
231 such as a periodic archival configuration along side a normal daily
232 configuration. Multiple configurations can run simultaneously on the same tape
233 server if there are multiple tape drives.
234 Scheduling of full dumps is typically left up to Amanda. They are scattered
235 throughout the dump cycle to balance the amount of data backed up each run.
236 It's important to keep logs of where backup images are for each area (which
237 Amanda does for you), since they are not on a specific, predictable, tape
238 (e.g., the Friday tape will not always have a full dump of /usr for client A).
239 The partial backup level is also left to Amanda. History information about
240 previous levels is kept and the backup level automatically increases when
241 sufficient dump size savings will be realized.
242 Amanda uses a simple tape management system and protects itself from
243 overwriting tapes that still have valid dump images and from tapes not
244 allocated to the configuration. Images may be overwritten when a client is down
245 for an extended period or if not enough tapes are allocated, but only after
246 Amanda has issued several warnings. Amanda can also be told to not reuse
247 specific tapes.
248 A validation program may be used before each run to note potential problems
249 during normal working hours when they are easier to correct. An activity report
250 is sent via e-mail after each run. Amanda can also send a report to a printer
251 and even generate sticky tape labels.
252 There is no graphical interface. For administration, there is usually only a
253 single simple text file to edit, so this is not much of an issue. For security
254 reasons, Amanda does not support user controlled file recovery. There is an
255 ftp-like restore utility for administrators to make searching online dump
256 catalogues easier when recovering individual files.
257
258 Future Capabilities of Amanda
259
260 In addition to the usual enhancements and fixes constantly being added by the
261 Amanda Core Development Team, three main changes are in various stages of
262 development.
263
264 * A new internal security framework will make it easier for developers to add
265   other security methods, such as SSH (ftp://ftp.cs.hut.fi/pub/ssh/) and SSL
266   (Secure Socket Layer).
267 * Another major project is a redesign of how Amanda runs the client dump
268   program. This is currently hardcoded for a vendor dump program, GNU-tar or
269   SAMBA tar. The new mechanism will allow arbitrary programs such as cpio,
270   star, and possibly other backup systems. It will also add optional pre-dump
271   and post-dump steps that can be used for locking and unlocking, and snapshots
272   of rapidly changing data such as databases or the Windows registry.
273 * The third major project is a redesign of the output subsystem to support non-
274   tape media such as CD-ROM, local files, remote files via tools like rcp and
275   ftp, remote tapes, etc. It will also be able to split dump images across
276   media, handle multiple simultaneous media of different types such as writing
277   to multiple tapes or a tape and a CD-ROM, and handle writing copies of images
278   to multiple media such as a tape to keep on site and a CD-ROM or duplicate
279   tape for archiving.
280 * In addition, the output format will be enhanced to include a file-1 and a
281   file-n. The idea is to put site-defined emergency recovery tools in file-1
282   (the first file on the output) that can be retrieved easily with standard
283   non-Amanda programs like tar, then use those tools to retrieve the rest of
284   the data. The file-n area is the last file on the output and can contain
285   items such as the Amanda database, which would be complete and up to date by
286   the time file-n is written.
287
288
289 Amanda Resources
290
291 Amanda may be obtained via the web page http://www.amanda.org or with anonymous
292 ftp at ftp://ftp.amanda.org/pub/amanda.A typical release is a gzip compressed
293 tar file with a name like amanda-2.4.1.tar.gz, which means it is major version
294 2.4 and minor version 1. There are occasional patch releases that have a name
295 like amanda-2.4.1p1.tar.gz (release 2.4.1 plus patch set 1). Beta test pre-
296 releases have a names like amanda-2.5.0b3.tar.gz (third beta test pre-release
297 of 2.5.0).
298 Some operating system distributions provide pre-compiled versions of Amanda,
299 but because Amanda hardcodes some values into the programs, they may not match
300 the configuration. Work is being done to move these values to run-time
301 configuration files, but for now Amanda should be built from source.
302 The Amanda web page contains useful information about patches not yet part of a
303 release, how to subscribe to related mailing lists, and pointers to mailing
304 list archives. Subscribe to at least amanda-announce to get new release
305 announcements or amanda-users to get announcements plus see problems and
306 resolutions from other Amanda users. The amanda-users mailing list is a
307 particularly good resource for help with initial setup as well as problems.
308 When posting to it, be sure to include the following information:
309
310 * Amanda version
311 * OS version on the server and client(s)
312 * Exact symptoms seen, such as error messages, relevant sections of e-mail
313   reports, debugging and log files
314 * Anything unusual or recent changes to the environment
315 * A valid return e-mail address
316
317 Finally, the docs directory in the release contains several files with helpful
318 information, such as a FAQ.
319
320 Installing Amanda
321
322 After downloading and unpacking the Amanda release, read the README, docs/
323 INSTALL, and docs/SYSTEM.NOTES files. They contain important and up-to-date
324 information about how to set up Amanda.
325
326 Install Related Packages
327
328 Several other packages may be required to complete an Amanda install. Before
329 continuing, you should locate and install packages your environment will need.
330 In particular, consider the following:
331
332
333   GNU-tar 1.12 or later \14 www.gnu.org
334       The GNU version of the standard tar program with enhancements to do
335       partial backups and omit selected files. It is one of the client backup
336       programs Amanda knows how to use.
337
338   Samba 1.9.18p10 or later \14 www.samba.org
339       SAMBA is an implementation of the System Message Block (SMB) protocol
340       used by Windows-based systems for file access. It contains a tool,
341       smbclient, that Amanda can use to back them up.
342
343   Perl 5.004 or later \14 www.perl.org
344       Perl is a scripting programming language oriented toward systems
345       programming and text manipulation. It is used for a few optional Amanda
346       reporting tools and by some tape changers.
347
348   GNU readline 2.2.1 or later \14 www.gnu.org
349       The GNU readline library may be incorporated into interactive programs to
350       provide command-line history and editing. It is built into the Amanda
351       amrecover restoration tool, if available.
352
353   GNU awk 3.0.3 or later \14 www.gnu.org
354       The GNU version of the awk programming language contains a common version
355       across platforms and some additional features. It is used for the
356       optional Amanda amplot statistics tool.
357
358   Gnuplot 3.5 or later \14 ftp://ftp.dartmouth.edu/pub/gnuplot/
359       This gnuplot library (which has nothing to do with the GNU tools, see the
360       accompanying README) is a graph plotting package. It is used for the
361       optional Amanda amplot statistics tool.
362
363 Be sure to look in the Amanda patches directory and the patches section on the
364 web page for updates to these packages. SAMBA versions before 2.0.3, in
365 particular, must have patches applied to make them work properly with Amanda.
366 Without the patches, backups appear to work but the resulting images are
367 corrupt.
368 When Amanda is configured, locations of additional software used on the
369 clients, such as GNU-tar and SAMBA, get built into the Amanda programs, so
370 additional software must be installed in the same place on the Amanda build
371 machine and all the clients.
372
373 Perform Preliminary Setup
374
375 A typical Amanda configuration runs as a user other than root, such as backup
376 or amanda, given just enough permissions to do backups. Often, direct login as
377 the user is disallowed. To use the vendor dump program instead of GNU-tar, the
378 Amanda user must be in a group with read access to the raw disk devices.
379 Membership in this group should be tightly controlled since it opens up every
380 file on the client for viewing.
381 There are two ways to link Amanda and the raw device group membership. Either
382 put the Amanda user in the group that currently owns the raw devices, as the
383 primary group or as a secondary, or pick a new group for Amanda and change the
384 group ownership of the devices. Amanda (actually, the vendor dump program)
385 needs only read access, so turn off group write permission. Turn off all
386 "world" access.
387 To use GNU-tar, Amanda runs it under a setuid-root program that grants the
388 needed permissions. The GNU version of tar must be used with Amanda. Vendor
389 supplied versions (unless they originated from GNU and are at least version
390 1.12) do not work because Amanda depends on additional features.
391
392 Configure the Amanda Build
393
394 Use the Amanda user and group for the --with-user and --with-group options to
395 ./configure. For instance, to use amanda for the user and backup as the group:
396 ./configure --with-user=amanda --with-group=backup ...
397 No other options are required for ./configure, but all the possibilities may be
398 seen with ./configure --help. Don't get carried away changing options. The
399 defaults are usually suitable and some require experience with Amanda to fully
400 understand. Leave --with-debugging enabled so debug log files are created on
401 the clients. They take very little space but are often necessary for tracking
402 down problems.
403 The normal build creates both tape server and client software. The tape server
404 host is often backed up by Amanda and needs the client parts. However, the
405 clients usually do not need the tape server parts. A little disk space and
406 build time may be saved by adding --without-server to the ./configure arguments
407 when building for them.
408 The default security mechanism uses a file formatted just like .rhosts but
409 called .amandahosts. This keeps Amanda operations separate from normal rsh/rcp
410 work that might use the same user. It is not recommended, but .rhosts and
411 hosts.equiv may be used by adding --without-amandahosts to the ./configure
412 arguments.
413 The TCP ports used for data transfer may be restricted with --with-portrange to
414 use Amanda between hosts separated by a firewall. A typical entry would be: ./
415 configure --with-portrange=50000,50100 ... This does not affect the initial UDP
416 requests made from the tape server to the clients. The amanda UDP port
417 (typically 10080) must be allowed through the firewall.
418 If more than just a few ./configure options are used, they may be put in /usr/
419 local/share/config.site or /usr/local/etc/config.site to keep them the same
420 from build to build. An example is in example/config.site.
421
422 Build and Install Amanda
423
424 After ./configure is done, run make to build Amanda, then make install to
425 install it. The make install step must be done as root because some Amanda
426 programs require system privileges. Unless the base location is changed, Amanda
427 installs into these areas:
428
429
430   /usr/local/sbin
431       Programs administrators run.
432
433   /usr/local/lib
434       Libraries.
435
436   /usr/local/libexec
437       Private programs only Amanda uses.
438
439   /usr/local/man
440       Documentation.
441
442 Now is a good time to read the main Amanda man page. It provides an overview of
443 Amanda, a description of each program, and detailed configuration information.
444 The following programs must be setuid-root (which make install as root does).
445 The first group (amcheck,dumper, and planner) run on the tape server machine
446 and need a privileged network port for secure communication with the clients.
447 The others are utility routines optionally used on the clients, depending on
448 the dump program used and operating system type.
449
450
451   sbin/amcheck
452       Amanda sanity checker program
453
454   libexec/dumper
455       Client communication program
456
457   libexec/planner
458       Estimate gathering program
459
460   libexec/killpgrp
461       Used to kill vendor dump programs that run as root
462
463   libexec/rundump
464       Setuid wrapper for systems that need to run the vendor dump program as
465       root
466
467   libexec/runtar
468       Setuid wrapper to run GNU-tar as root
469
470 All these programs are installed with world access disabled and group access
471 set to the Amanda group from --with-group. Be sure all members of that group
472 are trustworthy since rundump and runtar in particular give access to every
473 file on the system. If Amanda software is made available via NFS, be sure the
474 mount options allow setuid programs. Also, if GNU-tar is used, root needs write
475 access to /usr/local/var/amanda/gnutar-lists (or the --with-gnutar-list value
476 to ./configure) to store information about each partial level.
477 If the build has trouble or Amanda needs to be rebuilt, especially with
478 different ./configure options, the following sequence makes sure everything is
479 cleaned up from the previous build: make distclean ./configure ... make make
480 install (as root) Problems with the ./configure step can sometimes be diagnosed
481 by looking at the config.log file. It contains detailed output of tests ./
482 configure runs. Note that it is normal for many of the tests to "fail" as part
483 of ./configure determining how to access various features on the system.
484 A common problem when using the GNU C compiler is not re-installing it after
485 the underlying operating system version changes. Gcc is particularly sensitive
486 to system header files and must be re-installed or have its fixincludes step
487 rerun (see the gcc release installation notes) if the operating system is
488 upgraded. Running gcc --verbose shows where gcc gets its information, and
489 contains an indication of the operating system version expected.
490 Amanda needs changes to the network services and inetd configuration files. The
491 client-src/patch-system script should be able to set up systems in most cases.
492 It does not currently handle systems that deliver service entries via YP/NIS.
493 If the script does not work, add the following entries to the services file
494 (e.g., /etc/services) or YP/NIS map: Amanda 10080/udp Amandaidx 10082/tcp
495 Amidxtape 10083/tcp
496 Each client needs an entry in the inetd configuration file (e.g., /etc/
497 inetd.conf) like this, substituting the Amanda user for Amanda and the full
498 path to the Amanda libexec directory for PATH: amanda dgram udp wait Amanda /
499 PATH/libexec/amandad amandad
500 The amanda service is used by all Amanda controlling programs to perform
501 functions on the clients.
502 The tape server host needs entries like these if the amrecover tool is to be
503 used: amandaidx stream tcp nowait Amanda /PATH/libexec/amindexd amindexd
504 amidxtape stream tcp nowait Amanda /PATH/libexec/amidxtaped amidxtaped
505 The amandaidx service provides access to the catalogues, while amidxtape
506 provides remote access to a tape device. After every inetd configuration file
507 change, send a HUP signal to the inetd process and check the system logs for
508 errors.
509
510 Configuring Amanda
511
512 Once installed, Amanda must be configured to your environment.
513
514 Decide on a Tape Server
515
516 The first thing to decide is what machine will be the Amanda tape server.
517 Amanda can be CPU-intensive if configured to do server compression, and almost
518 certainly network and I/O-intensive. It does not typically use much real
519 memory. It needs direct access to a tape device that supports media with enough
520 capacity to handle the expected load.
521 To get a rough idea of the backup sizes, take total disk usage (not capacity),
522 Usage, and divide it by how often full dumps will be done, Runs. Pick an
523 estimated run-to-run change rate, Change. Each Amanda run, on average, does a
524 full dump of Usage/Runs. Another Usage/Runs*Change is done of areas that got a
525 full dump the previous run, Usage/Runs*Change* is done of areas that got a full
526 dump two runs ago, and so on.
527 For example, with 100 GB of space in use, a full dump every seven runs (e.g.,
528 days) and estimated run-to-run changes (new or altered files) of 5 percent:
529
530           100 GBytes / 7              = 14.3 GB
531           100 GBytes / 7 * 5%         =  0.7 GB
532           100 GBytes / 7 * 5% * 2     =  1.4 GB
533           100 GBytes / 7 * 5% * 3     =  2.1 GB
534           100 GBytes / 7 * 5% * 4     =  2.9 GB
535           100 GBytes / 7 * 5% * 5     =  3.6 GB
536           100 GBytes / 7 * 5% * 6     =  4.3 GB
537                                       = 29.3 GB
538         
539
540 If 50 percent compression is expected, the actual amount of tape capacity
541 needed for each run, which might be on more than one tape, would be 14.7 GB.
542 This is very simplistic, and could be improved with greater knowledge of actual
543 usage, but should be close enough to start with. It also gives an estimate of
544 how long each run will take by dividing expected capacity by drive speed.
545
546 Decide Which Tape Devices to Use
547
548 Unix operating systems typically incorporate device characteristics into the
549 file name used to access a tape device. The two to be concerned with are
550 "rewind" and "compression." Amanda must be configured with the non-rewinding
551 tape device, so called because when the device is opened and closed it stays at
552 the same position and does not automatically rewind. This is typically a name
553 with an n in it, such as /dev/rmt/0n or /dev/nst0. On AIX, it is a name with a
554 .1 or .5 suffix.
555 Put the Amanda user in the group that currently owns the tape device, either as
556 the primary group or as a secondary, or pick a new group for Amanda and change
557 the group ownership of the device. Amanda needs both read and write access.
558 Turn off all "world" access.
559
560 Decide Whether to Use Compression
561
562 Dump images may optionally be compressed on the client, the tape server, or the
563 tape device hardware. Software compression allows Amanda to track usage and
564 make better estimates of image sizes, but hardware compression is more
565 efficient of CPU resources. Turn off hardware compression when using software
566 compression on the client or server. See the operating system documentation for
567 how hardware compression is controlled; on many systems it is done via the
568 device file name just like the non-rewinding flag. AIX uses the chdev command.
569
570 Decide Where the Holding Space Will Be
571
572 If at all possible, allocate some holding disk space for Amanda on the tape
573 server. Holding disk space can significantly reduce backup time by allowing
574 several dumps to be done at once while the tape is being written. Also, for
575 streaming tape devices, Amanda keeps the device going at speed, and that may
576 increase capacity. Amanda may be configured to limit disk use to a specific
577 value so it can share with other applications, but a better approach is to
578 allocate one or more inexpensive disks entirely to Amanda.
579 Ideally, there should be enough holding disk space for the two largest backup
580 images simultaneously, so one image can be coming into the holding disk while
581 the other is being written to tape. If that is not practical, any amount that
582 holds at least a few of the smaller images helps. The Amanda report for each
583 run shows the size of the dump image after software compression (if enabled).
584 That, in addition to the amplot and amstatus tools, may be used to tune the
585 space allocated.
586
587 Compute Your Dump Cycle
588
589  Decide how often Amanda should do full dumps. This is the "dump cycle." Short
590 periods make restores easier because there are fewer partials, but use more
591 tape and time. Longer periods let Amanda spread the load better but may require
592 more steps during a restore.
593 Large amounts of data to back up or small capacity tape devices also affect the
594 dump cycle. Choose a period long enough that Amanda can do a full dump of every
595 area during the dump cycle and still have room in each run for the partials.
596 Typical dump cycles are one or two weeks. Remember that the dump cycle is an
597 upper limit on how often full dumps are done, not a strict value. Amanda runs
598 them more often and at various times during the cycle as it balances the backup
599 load. It violates the limit only if a dump fails repeatedly, and issues
600 warnings in the e-mail report if that is about to happen.
601 By default, Amanda assumes it is run every day. If that is not the case, set
602 "runs per cycle" (described below) to a different value. For instance, a dump
603 cycle of seven days and runs per cycle of five would be used if runs are done
604 only on weekdays.
605 Normally, Amanda uses one tape per run. With a tape changer (even the chg-
606 manual one), the number of tapes per run may be set higher for extra capacity.
607 This is an upper limit on the number of tapes. Amanda uses only as much tape as
608 it needs. Amanda does not yet do overflow from one tape to another. If it hits
609 end of tape (or any other error) while writing an image, that tape is
610 unmounted, the next one is loaded, and the image starts over from the
611 beginning. This sequence continues if the image cannot fit on a tape.
612 Runs per cycle and tapes per run determine the minimum number of tapes needed,
613 called the "tape cycle." To ensure the current run is not overwriting the last
614 full dump, one more run should be included. For instance, a dump cycle of two
615 weeks, with default runs per cycle of 14 (every day) and default tapes per run
616 of one, needs at least 15 tapes (14+1 runs * one tape/run). Using two tapes per
617 run needs 30 tapes (14+1 runs * two tapes/run). Doing backups just on weekdays
618 with a dump cycle of two weeks, runs per cycle of 10, and two tapes per run
619 needs 22 tapes (10+1 runs * two tapes/run).
620 More tapes than the minimum should be allocated to handle error situations.
621 Allocating at least two times the minimum allows the previous full dump to be
622 used if the most recent full dump cannot be read. Allocating more tapes than
623 needed also goes back further in time to recover lost files. Amanda does not
624 have a limit on the number of tapes in the tape cycle.
625
626 Copy and Edit the Default Configuration File
627
628 Pick a name for the configuration (the name Daily will be used for the rest of
629 this section). Create a directory on the tape server machine to hold the
630 configuration files, typically /usr/local/etc/amanda/Daily. Access to this
631 directory (or perhaps its parent) should be restricted to the Amanda group or
632 even just the Amanda user.
633 Each tape assigned to a configuration needs a unique label. For this example,
634 we'll use the configuration name, a dash, and a three-digit suffix, Daily-000
635 through Daily-999. Do not use blanks, tabs, slashes (/), shell wildcards, or
636 non-printable characters.
637 Amanda limits network usage so backups do not take all the capacity. This limit
638 is imposed when Amanda is deciding whether to perform a dump by estimating the
639 throughput and adding that to dumps that are already running. If the value
640 exceeds the bandwidth allocated to Amanda, the dump is deferred until enough
641 others complete. Once a dump starts, Amanda lets underlying network components
642 do any throttling.
643 Copy the template example/amanda.conf file to the configuration directory and
644 edit it. Full documentation is in the amanda man page. There are many
645 parameters, but probably only a few need to be changed. Start with the
646 following (some of which are described later):
647
648
649   org
650       This string will be in the Subject line of Amanda e-mail reports.
651
652   mailto
653       Target address for Amanda e-mail reports.
654
655   dumpuser
656       Same as --with-user from ./configure.
657
658   dumpcycle
659       The dump cycle.
660
661   runspercycle
662       The runs per cycle.
663
664   tapecycle
665       The tape cycle.
666
667   runtapes
668       Number of tapes to use per run.
669
670   tapedev
671       The no-rewind tape device if a changer is not being used, or if the
672       manual changer is being used.
673
674   tapetype
675       Type of tape media.
676
677   netusage
678       Network bandwidth allocated to Amanda.
679
680   labelstr
681       A regular expression (grep pattern) used to make sure each tape is
682       allocated to this Amanda configuration. Our example might use Daily-[0-9]
683       [0-9][0-9].
684
685 The following parameters probably do not need to be changed, but look at their
686 values to know where Amanda expects to find things:
687
688
689   infofile
690       Location of Amanda history database. Older versions of Amanda used this
691       as the base name of a database file. Newer versions use this as a
692       directory name.
693
694   logdir
695       Directory where Amanda logs are stored.
696
697   indexdir
698       Location of optional Amanda catalogue database.
699
700
701 Configure the Holding Disk
702
703 Define each holding disk in an amanda.conf holdingdisk section. If partitions
704 are dedicated to Amanda, set the use value to a small negative number, such as
705 -10 MB. This tells Amanda to use all but that amount of space. If space is
706 shared with other applications, set the value to the amount Amanda may use,
707 create the directory and set the permissions so only the Amanda user can access
708 it.
709 Set a chunksize value for each holding disk. Positive numbers split dumps in
710 the holding disk into chunks no larger than the chunksize value. Negative
711 numbers are no longer supported. Even though the images are split in the
712 holding disk, they are written to tape as a single image. At the moment, all
713 chunks for a given image go to the same holding disk.
714 Older operating systems that do not support individual files larger than 2GB
715 need a chunk size slightly smaller, such as 2000 MB, so the holding disk can
716 still be used for very large dump images. Systems that support individual files
717 larger than 2 GB should have a very large value, such as 2000 GBytes.
718
719 Configure Tape Devices and Label Tapes
720
721 Amanda needs to know some characteristics of the tape media. This is set in a
722 tapetype section. The example amanda.conf, web page, and amanda-users mailing
723 list archives have entries for most common media. Currently, all tapes should
724 have the same characteristics. For instance, do not use both 60-meter and 90-
725 meter DAT tapes since Amanda must be told the smaller value, and larger tapes
726 may be underutilized.
727 If the media type is not listed and there are no references to it in the
728 mailing list archives, go to the tape-src directory, make tapetype, mount a
729 scratch tape in the drive and run ./tapetype NAME DEV where NAME is a text name
730 for the media and DEV is the no-rewind tape device with hardware compression
731 disabled. This program rewinds the tape, writes random data until it fills the
732 tape, rewinds, and then writes random data and tape marks until it fills the
733 tape again. This can take a very long time (hours or days). When finished, it
734 generates a new tapetype section to standard output suitable for adding to the
735 amanda.conf file. Post the results to the amanda-users mailing list so others
736 may benefit from your effort.
737 When using hardware compression, change the length value based on the estimated
738 compression rate. This typically means multiplying by something between 1.5 and
739 2.0.
740 The length and filemark values are used by Amanda only to plan the backup
741 schedule. Once dumps start, Amanda ignores the values and writes until it gets
742 an error. It does not stop writing just because it reaches the tapetype length.
743 Amanda does not currently use the tapetype speed parameter.
744 Once the tapetype definition is in amanda.conf, set the tapetype parameter to
745 reference it.
746 Without special hardware to mount tapes, such as a robot or stacker, either set
747 the tapedev parameter to the no-rewind device name or set up the Amanda chg-
748 manual changer. The manual changer script prompts for tape mounts as needed.
749 The prompts normally go to the terminal of the person running Amanda, but the
750 changer may be configured to send requests via e-mail or to some other system
751 logging mechanism.
752 To configure the manual changer, set tapedev to the no-rewind tape device and
753 set tpchanger to chg-manual. To send tape mount prompts someplace other than
754 the terminal, which is necessary if Amanda is run from a cron job, see the
755 request shell function comments in changer-src/chg-manual.sh.in.
756 Another common tape changer is chg-multi. This script can drive stackers that
757 advance to the next tape when the drive is unloaded or it can use multiple tape
758 drives on the tape sever machine to emulate a changer. The chg-multi script has
759 a configuration file and a state file. Put the path to the configuration file
760 in the amanda.conf changerfile parameter. There is a sample in example/chg-
761 multi.conf. It has the following keyword/value pairs separated by whitespace:
762
763
764   firstslot
765       Number of the first slot in the device.
766
767   lastslot
768       Number of the last slot in the device.
769
770   gravity
771       Set to 1 if the device is gravity fed and cannot go backwards, otherwise
772       set to 0.
773
774   needeject
775       Set to 1 if the tape needs to be ejected to advance to a new tape,
776       otherwise set to 0.
777
778   multieject
779       Set to 1 if sending multiple ejects causes the changer to advance through
780       the tapes, otherwise set to 0. If set to 1, gravity must also be set to 1
781       because the script currently does not handle carousels that wrap back
782       around to the first tape after the last one. Also, needeject must be set
783       to 0.
784
785   ejectdelay
786       Set to a number of seconds of extra delay after ejecting a tape if it
787       takes a while before the next tape is ready.
788
789   statefile
790       Set to the path to a file chg-multi builds and maintains with the current
791       state of the changer.
792
793   slot
794       Repeat as needed to define all the slots and corresponding tape devices.
795       The first field after slot is the slot number. The next field is the no-
796       rewind tape device name. For changers that have a single tape device,
797       repeat the device name for each slot. To emulate a changer by using
798       multiple tape devices, list a different no-rewind tape device for each
799       slot.
800
801 chg-multi may also be used as a framework to write a new changer. Look for XXX
802 comments in the script and insert calls to commands appropriate for the device.
803 Make any source changes to the changer-src/chg-multi.sh.in file. That file is
804 processed by ./configure to generate chg-multi.sh, which turns into chg-multi
805 with make. If chg-multi.sh or chg-multi is altered, the changes will be lost
806 the next time Amanda is rebuilt.
807 A third popular changer is chg-scsi. It can drive devices that have their own
808 SCSI interface. An operating system kernel module may need to be installed to
809 control such devices, like sst for Solaris, which is released with Amanda, or
810 chio, available for various systems. As with chg-multi, set the amanda.conf
811 changerfile parameter to the changer configuration file path. There is a sample
812 in example/chg-scsi.conf. The initial section has parameters common to the
813 entire changer:
814
815
816   number_configs
817       Set to the number of tape drives connected to this changer. The default
818       is 1.
819
820   eject
821       Set to 1 if tape drives need an explicit eject command before advancing
822       to the next tape, otherwise set to 0.
823
824   sleep
825       Set to the number of seconds to wait for a tape drive to become ready.
826
827   changerdev
828       Set to the device path of the changer. This may be set in the amanda.conf
829       file instead of here if preferred. Following the common parameters is a
830       section for each tape device:
831
832   config
833       Set to the configuration number, starting with 0.
834
835   drivenum
836       Set to the tape drive number, usually the same as the configuration
837       number.
838
839   dev
840       Set to the no-rewind device name of the tape drive.
841
842   startuse
843       Set to the number of the first slot served by this drive.
844
845   enduse
846       Set to the number of the last slot served by this drive.
847
848   statfile
849       Set to the path to a file chg-scsi will build and maintain with the
850       current state of this drive.
851
852 Test any changer setup with the amtape command. Make sure it can load a
853 specific tape with the slot NNN suboption, eject the current tape with eject
854 and advance to the next slot with slot next.
855 Tapes must be pre-labeled with amlabel so Amanda can verify the tape is one it
856 should use. Run amlabel as the Amanda user, not root. For instance:
857
858         
859             # su amanda -c "amlabel Daily Daily-123 slot 123"
860         
861         
862
863
864 Configure Backup Clients
865
866 After tapes are labeled, pick the first client, often the tape server host
867 itself, and the filesystems or directories to back up. For each area to back
868 up, choose either the vendor dump program or GNU-tar. Vendor dump programs tend
869 to be more efficient and do not disturb files being dumped, but are usually not
870 portable between different operating systems. GNU-tar is portable and has some
871 additional features, like the ability to exclude patterns of files, but alters
872 the last access time for every file backed up and may not be as efficient. GNU-
873 tar may also deal with active filesystems better than vendor dump programs, and
874 is able to handle very large filesystems by breaking them up by subdirectories.
875 Choose the type of compression for each area, if any. Consider turning off
876 compression of critical areas needed to bring a machine back from the dead in
877 case the decompression program is not available. Client compression spreads the
878 load to multiple machines and reduces network traffic, but may not be
879 appropriate for slow or busy clients. Server compression increases the load on
880 the tape server machine, possibly by several times since multiple dumps are
881 done at once. For either, if GNU GNU-zip is used, compression may be set to
882 fast for faster but less aggressive compression or best for slower but more
883 aggressive compression. Set compression to none to disable software compression
884 or use hardware compression.
885 Pick or alter an existing dumptype that matches the desired options, or create
886 a new one. Each dumptype should reference the global dumptype. It is used to
887 set options for all other dumptypes. For instance, to use the indexing
888 facility, enable it in the global dumptype and all other dumptypes will inherit
889 that value.
890 The indexing facility generates a compressed catalogue of each dump image.
891 These are useful for finding lost files and are the basis of the amrecover
892 program. Long dump cycles or areas with many or very active files can cause the
893 catalogues to use a lot of disk space. Amanda automatically removes catalogues
894 for images that are no longer on tape.
895 Create a file named disklist in the same directory as amanda.conf and either
896 copy the file from example/disklist or start a new one. Make sure it is
897 readable by the Amanda user. Each line in disklist defines an area to be backed
898 up. The first field is the client host name (fully qualified names are
899 recommended), the second is the area to be backed up on the client and the
900 third is the dumptype. The area may be entered as a disk name, (sd0a), a device
901 name, (/dev/rsd0)a, or a logical name, (/usr). Logical names make it easier to
902 remember what is being backed up and to deal with disk reconfiguration.
903 To set up a Windows client, set the host name to the name of the Unix machine
904 running SAMBA and the area to the Windows share name, such as //some-pc/C$.
905 Note that Unix-style forward slashes are used instead of Windows-style backward
906 slashes.
907 Enable Amanda access to the client from the tape server host (even if the
908 client is the tape server host itself) by editing .amandahosts (or .rhosts,
909 depending on what was set with ./configure) in the Amanda user home directory
910 on the client. Enter the fully qualified tape server host name and Amanda user,
911 separated by a blank or tab. Make sure the file is owned by the Amanda user and
912 does not allow access to anyone other than the owner (e.g. mode 0600 or 0400).
913 For Windows clients, put the share password in /etc/amandapass on the SAMBA
914 host. The first field is the Windows share name, the second is the clear text
915 password and the optional third field is the domain.
916
917 Note
918
919 This info isn't correct anymore. Please refer to Backup_PC_hosts_using_Samba
920 for details on this file.
921 Because this file contains clear text passwords, it should be carefully
922 protected, owned by the Amanda user and only allow user access. By default,
923 Amanda uses SAMBA user backup. This can be changed with --with-samba-user to ./
924 configure.
925
926 Test and Debug Setup
927
928 Test the setup with amcheck. As with all Amanda commands, run it as the Amanda
929 user, not root:
930
931         
932             # su amanda -c "amcheck Daily"
933         
934         
935
936 Many errors reported by amcheck are described in docs/FAQ or the amcheck man
937 page. The most common error reported to the Amanda mailing lists is selfcheck
938 request timed out, meaning amcheck was not able to talk to amandad on the
939 client. In addition to the ideas in docs/FAQ, here are some other things to
940 try:
941
942 * Are the Amanda services listed properly in /etc/services or a YP/NIS map? The
943   C program in Figure 4-1 uses the same system call as Amanda to look up
944   entries:
945
946 Example 18.1. A C Program to Check the Amanda Service Numbers
947
948         
949             #include <stdio.h>
950             #include <string.h>
951             #include <netdb.h>
952
953             main (
954                 int argc,
955                 char **argv)
956             {
957                 char *pn;
958                 char *service;
959                 char *protocol = "tcp";
960                 struct servent *s;
961                 
962                 if ((pn = strrchr (*argv, '/')) == NULL) {
963                     pn = *argv;
964                 } else {
965                     pn++;
966                 } if (argc < 2) {
967                       fprintf (stderr, "usage: %s service [protocol]\n", pn);
968                       return 1;
969                 }
970                 service = *++argv;
971                 if (argc > 2) {
972                 protocol = *++argv;
973                 }
974                 if ((s = getservbyname (service, protocol)) == NULL) {
975                     fprintf (stderr, "%s: %s/%s lookup failed\n", pn,
976                       service, protocol);
977                     return 1;
978                 }
979                 printf ("%s/%s: %d\n", service, protocol,
980                   (int) ntohs (s->s_port));
981                 return 0;
982             }
983         
984         
985
986
987 Run it on both the tape server and client and make sure the port numbers match:
988
989         
990             $ cc check-service.c -lnsl -lsocket (Solaris)
991             $ a.out amanda udp
992               amanda/udp: 10080
993             $ a.out amandaidx
994               amandaidx/tcp: 10082
995             $ a.out amidxtape
996               amidxtape/tcp: 10083
997         
998         
999
1000
1001 * Is there a line in the inetd configuration file on the client to start
1002   amandad?
1003 * Was inetd sent a HUP signal after the configuration file was changed?
1004 * Are there system log messages from inetd about amanda or amandad? For
1005   instance, inetd complains if it cannot look up the Amanda services.
1006 * Is /tmp/amanda/amandad/debug being updated?
1007 * Is the access time on the amandad executable (ls -lu) being updated? If not,
1008   inetd is probably not able to run it, possibly because of an error in the
1009   inetd configuration file or a permission problem.
1010 * Run the amandad program by hand as the Amanda user on the client. It should
1011   sit for about 30 seconds, then terminate. Enter the full path exactly as it
1012   was given to inetd, perhaps by using copy/paste.
1013
1014 Do not proceed until amcheck is happy with the configuration.
1015 For initial testing, set the record option to no in the global dumptype, but
1016 remember to set it back to yes when Amanda goes into normal production. This
1017 parameter controls whether the dump program on the client updates its own
1018 database, such as /etc/dumpdates for vendor dump.
1019 To forget about an individual test run, use amrmtape to remove references to
1020 the tapes used, then use amlabel to relabel them. To completely start over,
1021 remove the files or directories named in the infofile and indexdir parameters,
1022 the tapelist file named in the tapelist parameter, all amdump.* files in the
1023 configuration directory and all log.* files in the directory named by the
1024 logdir parameter. These files contain history information Amanda needs between
1025 runs and also what is needed to find particular dump images for restores and
1026 should be protected when Amanda goes into production.
1027
1028 Operating Amanda
1029
1030 Once configured, you will need to setup the automated use of Amanda.
1031
1032 Run amdump
1033
1034 The amdump script controls a normal Amanda backup run. However, it's common to
1035 do site-specific things as well with a wrapper shell script around amdump.
1036 amdump is meant to run unattended from cron. See the operating system
1037 documentation for how to set up a cron task. Be sure it runs as the Amanda
1038 user, not root or the installer.
1039 The amdump script does the following:
1040
1041 * If a file named hold is in the configuration directory, amdump pauses until
1042   it goes away. This may be created and removed by hand to temporarily delay
1043   Amanda runs without having to change the cron task.
1044 * If it looks like another copy of amdump is running, or a previous run
1045   aborted, amdump logs an error and terminates. If an earlier run aborted,
1046   amcleanup must be run. An amcleanup step should be added to the tape server
1047   system boot sequence to handle crashes. No backups can be performed after an
1048   abort or crash until amcleanup is run.
1049 * The Amanda planner program decides what areas to back up and at what level.
1050   It does this by connecting to each client and getting estimated sizes of a
1051   full dump, the same partial level that was done on the previous run and
1052   possibly the next partial level. All clients are done in parallel, but it can
1053   take a while to gather all this information.
1054 * The schedule is then passed to the driver program that controls actual
1055   dumping. It, in turn, starts up several dumper processes (based on the
1056   inparallel amanda.conf parameter) and a single taper process. The taper
1057   process splits into two parts, a reader and a writer, to keep streaming tape
1058   drives busy.
1059 * driver commands dumpers to start backups, telling each its client, area,
1060   options such as compression and whether the result should go to the holding
1061   disk or direct to tape. Each dumper connects to amandad on the client and
1062   sends a request describing the dump program to run and options such as
1063   whether to do compression or indexing. The image comes back to the dumper who
1064   writes it, possibly via the server compression program, into the holding disk
1065   or directly to a taper connection. If enabled, dumper also collects catalogue
1066   information generated on the client and compresses it into the indexdir area.
1067   The driver also commands taper to write files from the holding disk to tape
1068   or to prepare to receive an image directly from a dumper.
1069 * After backups are done, amreport is run to generate the e-mail report. It
1070   also renames the log file for the run to a unique log.YYYYMMDD.N name.
1071 * Old amdump.NN debug log files are rolled so only enough to match the tape
1072   cycle are retained.
1073 * The amtrmidx program is run to remove old catalogues if indexing has been
1074   used.
1075
1076 There are several ways to determine which tapes Amanda will need for a run. One
1077 is to look at the Amanda e-mail report from the previous run. The tapes used
1078 during that run and those expected for the next run are listed. Another is to
1079 run amcheck during normal working hours. In addition to showing which tapes are
1080 needed, it makes sure things are set up properly so problems can be fixed
1081 before the real Amanda run. A third is to use the tape suboption of amadmin.
1082 Without a tape changer, Amanda expects the first tape to be mounted in the
1083 drive when it starts. Automated tape changers should be able to locate the
1084 tapes. The chg-manual changer prompts for the tapes.
1085
1086 Read Amanda's Reports
1087
1088 An Amanda report has several sections:
1089
1090         
1091
1092
1093             These dumps were to tape Daily-009, Daily-010
1094             Tonight's dumps should go onto 2 tapes: Daily-011, Daily-012.
1095         
1096
1097         
1098 This shows which tapes were used during the run and which tapes are needed
1099 next.
1100
1101         
1102             FAILURE AND STRANGE DUMP SUMMARY:
1103               gurgi.cc.p /var lev 0 FAILED [Request to gurgi.cc.purdue.edu timed
1104   out.]
1105               gurgi.cc.p / lev 0 FAILED [Request to gurgi.cc.purdue.edu timed out.]
1106               pete.cc.pu /var/mail lev 0 FAILED ["data write: Broken pipe"]
1107               samba.cc.p //nt-test.cc.purdue.edu/F$ lev 1 STRANGE
1108               mace.cc.pu /master lev 0 FAILED [dumps too big, but cannot incremental
1109   dump new
1110               disk]
1111         
1112         
1113
1114 Problems found during the run are summarized in this section. In this example:
1115
1116 * gurgi.cc.purdue.edu was down, so all its backups failed.
1117 * The /var/mail problem on pete.cc.purdue.edu and F$ problem on nt-
1118   test.cc.purdue.edu are detailed later.
1119 * The /master area on mace.cc.purdue.edu is new to Amanda so a full dump is
1120   required, but it would not fit in the available tape space for this run.
1121
1122
1123         
1124             STATISTICS:
1125                                          Total            Full         Daily
1126                                         --------        --------      --------
1127               Dump Time (hrs:min)         5:03            3:23          0:33   (0:14
1128   start, 0:53 idle)
1129               Output Size (meg)        20434.4         17960.0        2474.4
1130               Original Size (meg)      20434.4         17960.0        2474.4
1131               Avg Compressed Size (%)      --              --            --
1132               Tape Used (%)              137.4           120.0          17.4
1133   (level:#disks ...)
1134               Filesystems Dumped            90              21            69    (1:
1135   64 2:2 3:3)
1136               Avg Dump Rate (k/s)       1036.5          1304.3         416.2
1137               Avg Tp Write Rate (k/s)   1477.6          1511.2        1271.9
1138         
1139         
1140
1141 This summarizes the entire run. It took just over five hours, almost 3.5 hours
1142 writing full dumps and about half an hour for partials. It took 14 minutes to
1143 get started, mostly in the planner step getting the estimates, and taper was
1144 idle almost one hour waiting on dumps to come into the holding disk.
1145 In this example, hardware compression was used so Avg Compressed Size is not
1146 applicable and Output Size written to tape matches Original Size from the
1147 clients. About 137% of the length of the tape as defined in the tapetype was
1148 used (remember that two tapes were written), 120% for full dumps and 17% for
1149 partials. The Rate lines give the dump speed from client to tape server and
1150 tape writing speed, all in KBytes per second. The Filesystems Dumped line says
1151 90 areas were processed, 21 full dumps and 69 partials. Of the partials, 64
1152 were level 1, two were level 2 and three were level 3.
1153
1154         
1155             FAILED AND STRANGE DUMP DETAILS:
1156         
1157                 /-- pete.cc.pu /var/mail lev 0 FAILED ["data write: Broken
1158   pipe"]
1159               sendbackup: start [pete.cc.purdue.edu:/var/mail level 0]
1160               sendbackup: info BACKUP=/usr/sbin/ufsdump
1161               sendbackup: info RECOVER_CMD=/usr/sbin/ufsrestore -f... -
1162               sendbackup: info end
1163               | DUMP: Writing 32 Kilobyte records
1164               | DUMP: Date of this level 0 dump: Sat Jan 02 02:03:22 1999
1165               | DUMP: Date of last level 0 dump: the epoch
1166               | DUMP: Dumping /dev/md/rdsk/d5 (pete.cc.purdue.edu:/var/mail) to
1167   standard output.
1168               | DUMP: Mapping (Pass I) [regular files]
1169               | DUMP: Mapping (Pass II) [directories]
1170               | DUMP: Estimated 13057170 blocks (6375.57MB) on 0.09 tapes.
1171               | DUMP: Dumping (Pass III) [directories]
1172               | DUMP: Dumping (Pass IV) [regular files]
1173               | DUMP: 13.99% done, finished in 1:02
1174               | DUMP: 27.82% done, finished in 0:52
1175               | DUMP: 41.22% done, finished in 0:42
1176         
1177               /-- samba.cc.p //nt-test.cc.purdue.edu/F$ lev 1 STRANGE
1178               sendbackup: start [samba.cc.purdue.edu://nt-test/F$ level 1]
1179               sendbackup: info BACKUP=/usr/local/bin/smbclient
1180               sendbackup: info RECOVER_CMD=/usr/local/bin/smbclient -f... -
1181               sendbackup: info end
1182               ? Can't load /usr/local/samba-2.0.2/lib/smb.conf - run testparm to
1183   debug it
1184               | session request to NT-TEST.CC.PURD failed
1185               |                 directory \top\
1186               |                 directory \top\Division\
1187               |        238 (    2.7 kb/s) \top\Division\contract.txt
1188               |      19456 ( 169.6 kb/s)  \top\Division\stuff.doc
1189             ...
1190         
1191         
1192
1193 Failures and unexpected results are detailed here. The dump of /var/mail would
1194 not fit on the first tape so was aborted and rerun on the next tape, as
1195 described further in the next section.
1196 The dump of F$ on nt-test.cc.purdue.edu failed due to a problem with the SAMBA
1197 configuration file. It's marked STRANGE because the line with a question mark
1198 does not match any of the regular expressions built into Amanda. When dumping
1199 Windows clients via SAMBA, it's normal to get errors about busy files, such as
1200 PAGEFILE.SYS and the registry. Other arrangements should be made to get these
1201 safely backed up, such as a periodic task on the PC that creates a copy that
1202 will not be busy at the time Amanda runs.
1203
1204         
1205             NOTES:
1206               planner: Adding new disk j.cc.purdue.edu:/var.
1207               planner: Adding new disk mace.cc.purdue.edu:/master.
1208               planner: Last full dump of mace.cc.purdue.edu:/src on tape Daily-012
1209   overwritten
1210                        in 2 runs.
1211               planner: Full dump of loader.cc.purdue.edu:/var promoted from 2 days
1212   ahead.
1213               planner: Incremental of sage.cc.purdue.edu:/var bumped to level 2.
1214               taper: tape Daily-009 kb 19567680 fm 90 writing file: short write
1215               taper: retrying pete.cc.purdue.edu:/var/mail.0 on new tape: [writing
1216   file: short
1217                      write]
1218               driver: pete.cc.purdue.edu /var/mail 0 [dump to tape failed, will try
1219   again]
1220               taper: tape Daily-010 kb 6201216 fm 1 [OK]
1221         
1222         
1223
1224 Informational notes about the run are listed here. The messages from planner
1225 say:
1226
1227 * There are new disklist entries for j.cc.purdue.edu and mace.cc.purdue.edu.
1228 * Tape Daily-012 is due to be overwritten in two more runs and contains the
1229   most recent full dump of /src from mace.cc.purdue.edu, so the tape cycle may
1230   not be large enough.
1231 * The next scheduled full dump of /var on loader.cc.purdue.edu was moved up two
1232   days to improve the load balance.
1233 * The partial dump of /var on sage.cc.purdue.edu was bumped from level 1 to
1234   level 2 because the higher level was estimated to save enough space to make
1235   it worthwhile.
1236
1237 The rest of the notes say taper was not able to write as much data as it
1238 wanted, probably because of hitting end of tape. Up to that point, it had
1239 written 19567680 KBytes in 90 files on tape Daily-009. Another attempt at the
1240 full dump of /var/mail from pete.cc.purdue.edu was made on the next tape
1241 (Daily-010) and it succeeded, writing 6201216 KBytes in one file.
1242
1243         
1244             DUMP SUMMARY:
1245         
1246                                              DUMPER STATS                   TAPER
1247   STATS
1248         HOSTNAME  DISK           L   ORIG-KB   OUT-KB COMP%   MMM:SS   KB/
1249   s  MMM:SS   KB/s
1250         --------------------------- --------------------------------------- ---
1251   -----------
1252         boiler.cc /              1      2624     2624   --      0:13  200.1
1253   0:02 1076.0
1254         boiler.cc /home/boiler/a 1       192      192   --      0:07   26.7
1255   0:02  118.5
1256         boiler.cc /usr           1       992      992   --      0:41   24.2
1257   0:02  514.7
1258         boiler.cc /usr/local     1       288      288   --      0:09   31.2
1259   0:04   86.3
1260         boiler.cc /var           1       425     4256   --      0:21  205.9
1261   0:04 1104.3
1262         egbert.cc /              1     41952    41952   --      1:26  487.3
1263   0:37 1149.4
1264         egbert.cc /opt           1       224      224   --      0:06   37.5
1265   0:02  136.0
1266         egbert.cc -laris/install 1        64       64   --      0:11    5.8
1267   0:02   49.5
1268         gurgi.cc. /              0    FAILED ----------------------------------
1269   -----------
1270         gurgi.cc. /var           0    FAILED ----------------------------------
1271   -----------
1272         pete.cc.p /              1     13408    13408   --      0:41  328.2
1273   0:08 1600.5
1274         pete.cc.p /opt           1      3936     3936   --      1:04   61.2
1275   0:03 1382.6
1276         pete.cc.p /usr           1      1952     1952   --      0:29   67.0
1277   0:03  584.3
1278         pete.cc.p /var           1    300768   300768   --      2:33 1963.8
1279   2:50 1768.8
1280         pete.cc.p /var/mail      0   6201184  6201184   --     73:45 1401.3
1281   73:47 1400.8
1282
1283        ...
1284        (brought to you by Amanda version 2.4.1p1)
1285         
1286         
1287
1288 This section (which has been abbreviated) reports each area dumped showing
1289 client, area, backup level, sizes, time to dump and time to write to tape.
1290 Entries are in alphabetic order by client and then by area. This is not the
1291 same as the tape order. Tape order can be determined with the find or info
1292 suboption of the amadmin command, amtoc can generate a tape table of contents
1293 after a run, or amreport can generate a printed listing. By default, client
1294 names are truncated on the right, area names on the left, to keep the report
1295 width under 80 character. This typically leaves the unique portions of both.
1296 Two log files are created during an Amanda run. One is named amdump.NN, where
1297 NN is a sequence number (1 is most recent, 2 is next most recent, etc), and is
1298 in the same directory as amanda.conf. The file contains detailed step by step
1299 information about the run and is used for statistics by amplot and amstatus,
1300 and for debugging. The other file is named log.YYYYMMDD.N where YYYYMMDD is the
1301 date of the Amanda run and N is a sequence number in case more than one run is
1302 made on the same day (0 for the first run, 1 for the second, etc). This file is
1303 in the directory specified by the logdir amanda.conf parameter. It contains a
1304 summary of the run and is the basis for the e-mail report. In fact, amreport
1305 may be run by hand and given an old file to regenerate a report.
1306 Old amdump.NN files are removed by the amdump script. Old log.YYYYMMDD.N files
1307 are not automatically removed and should be cleared out periodically by hand.
1308 Keeping a full tape cycle is a good idea. If the tape cycle is 40 and Amanda is
1309 run once a day, the following command would do the job:
1310
1311         
1312             #find log.????????.* -mtime +40 -print | xargs rm
1313         
1314         
1315
1316 If --with-pid-debug-files was used on ./configure, clients accumulate debug
1317 files in /tmp/amanda (or whatever --with-debug was set to) and should be
1318 cleaned out periodically. Without this option, client debug files have fixed
1319 names and are reused from run to run.
1320
1321 Monitor Tape and Holding Disk Status
1322
1323 While amdump is running, amstatus can track how far along it is. amstatus may
1324 also be used afterward to generate statistics on how many dumpers were used,
1325 what held things up and so on.
1326 When a tape error happens on the last tape allowed in a run (as set by
1327 runtapes), Amanda continues to do backups into the holding disks. This is
1328 called degraded mode. By default, full dumps are not done and any that were
1329 scheduled have a partial done instead. A portion of the holding disk area may
1330 be allocated to do full dumps during degraded mode by reducing the value of the
1331 parameter reserve in amanda.conf below 100%.
1332 A tape server crash may also leave images in the holding disks. Run amflush, as
1333 the Amanda user, to flush images in the holding disk to the next tape after
1334 correcting any problems. It goes through the same tape request mechanism as
1335 amdump. If more than one set of dumps are in the holding disk area, amflush
1336 prompts to choose one to write or to write them all. amflush generates an e-
1337 mail report just like amdump.
1338 Operating systems vary in how they report end of tape to programs. A no space
1339 or short write error probably means end of tape. For I/O error, look at the
1340 report to see how much was written. If it is close to the expected tape
1341 capacity, it probably means end of tape, otherwise it means a real tape error
1342 happened and the tape may need to be replaced the next time through the tape
1343 cycle.
1344 To swap out a partially bad tape, wait until it is about to be used again so
1345 any valid images can still be retrieved. Then swap the tapes, run amrmtape on
1346 the old tape and run amlabel on the replacement so it has a proper Amanda
1347 label.
1348 If a tape is marked to not be reused with the no-reuse suboption of amadmin,
1349 such as one that has been removed or is failing, Amanda may want a freshly
1350 labeled tape on the next run to get the number of tapes back up to the full
1351 tape cycle.
1352 If a tape goes completely bad, use amrmtape to make Amanda forget about it. As
1353 with marking a tape no-reuse, this may reduce the number of tapes Amanda has in
1354 use below the tape cycle and it may request a newly labeled tape on the next
1355 run.
1356
1357 Adding Tapes at a Particular Position in the Cycle
1358
1359
1360 * Run amlabel on the new tapes.
1361 * Edit the tapelist file by hand and move the new tapes before the tape to be
1362   used just ahead of them. For instance, move Daily-100 before Daily-099.
1363 * Set the date stamp on the new tapes to the same as the previous tape, e.g.
1364   make them the same for Daily-099 and Daily-100.
1365 * Update the tapecycle amanda.conf parameter if new tapes are being added.
1366
1367 These steps let Amanda know about all tapes, including those that do not have
1368 data yet. When the cycle gets to the last old tape (Daily-099), the next tape
1369 used will be the first new one (Daily-100). A new option is planned for amlabel
1370 to do these steps automatically.
1371
1372 Miscellanous Operational Notes
1373
1374 Multiple amdump runs may be made in the same day, although catalogues are
1375 currently stored without a timestamp so amrecover may not show all restore
1376 possibilities. To redo a few areas that failed during the normal run, edit the
1377 disklist file by hand to comment out all the other entries, run amdump, then
1378 restore the disklist file.
1379 Use the force suboption of amadmin to schedule a full dump of an area on the
1380 next run. Run this as the Amanda user, not root. Amanda automatically detects
1381 new disklist entries and schedules an initial full dump. But for areas that go
1382 through a major change, such as an operating system upgrade or full restore,
1383 force Amanda to do a full dump to get things back into sync.
1384 Amanda does not automatically notice new client areas, so keep the disklist in
1385 sync by hand. Amanda usually notices areas that are removed and reports an
1386 error as a reminder to remove the entry from the disklist. Use the delete
1387 suboption of amadmin (as the Amanda user) to make Amanda completely forget
1388 about an area, but wait until the information is not needed for restores. This
1389 does not remove the entry from the disklist file \14 that must be done by hand.
1390 Non\14Amanda backups may still be done with Amanda installed, but do not let the
1391 client dump program update its database. For vendor dump programs, this usually
1392 means not using the u flag, or saving and restoring /etc/dumpdates. For GNU-tar
1393 it means the --listed-incremental flag (if used) should not point to the same
1394 file Amanda uses.
1395 As with all backup systems, verify the resulting tapes, if not each one then at
1396 least periodically or by random sample. The amverify script does a reasonably
1397 good job of making sure tapes are readable and images are valid. For GNU-tar
1398 images, the test is very good. For vendor dump images of the same operating
1399 system type as the tape server machine, the test is OK but does not really
1400 check the whole image due to the limited way the catalogue option works. For
1401 vendor dump images from other operating systems, amverify can tell if the image
1402 is readable from tape but not whether it is valid.
1403 Tape drives are notorious for being able to read only what they wrote, so run
1404 amverify on another machine with a different drive, if possible, so an
1405 alternate is available if the primary drive fails. Make a copy of the Amanda
1406 configuration directory on the other machine to be able to run amverify. This
1407 copy is also a good way to have a backup of the Amanda configuration and
1408 database in case the tape server machine needs to be recovered.
1409
1410 Advanced Amanda Configuration
1411
1412 Once you have Amanda running for a while, you may choose to do some additional
1413 advanced configuration.
1414
1415 Adjust the Backup Cycle
1416
1417 Several dumptype parameters control the backup level Amanda picks for a run:
1418
1419
1420   dumpcycle
1421       Maximum days between full dumps.
1422
1423   strategy nofull
1424       Never schedule (or run) a full dump.
1425
1426   strategy incronly
1427       Only schedule non-full dumps.
1428
1429 Note that dumpcycle is both a general amanda.conf parameter and a specific
1430 dumptype parameter. The value in a specific dumptype takes precedence. To
1431 handle areas that change significantly between each run and should get a full
1432 dump each time (such as the mail spool on a busy e-mail server or a database
1433 area), create a dumptype based on another dumptype with attributes changed as
1434 desired (client dump program, compression, etc) and set dumpcycle in the new
1435 dumptype to 0:
1436
1437         
1438
1439
1440             define mail-spool {
1441                 comp-user-tar
1442                 dumpcycle 0
1443             }
1444         
1445
1446         
1447 To run full dumps by hand outside of Amanda (perhaps they are too large for the
1448 normal tape capacity, or need special processing), create a new dumptype and
1449 set strategy to incronly:
1450
1451         
1452             define full-too-big {
1453                 comp-user-tar
1454                 strategy incronly
1455             }
1456         
1457         
1458
1459 Tell Amanda when a full dump of the area has been done with the force suboption
1460 of amadmin. Take care to do full dumps often enough that the tape cycle does
1461 not wrap around and overwrite the last good non-full backups.
1462 To never do full dumps (such as an area easily regenerated from vendor media),
1463 create a new dumptype and set strategy to nofull:
1464
1465         
1466             define man-pages {
1467                 comp-user-tar
1468                 strategy nofull
1469             }
1470         
1471         
1472
1473 Only level 1 backups of such areas are done, so wrapping around the tape cycle
1474 is not a problem.
1475 To do periodic archival full dumps, create a new Amanda configuration with its
1476 own set of tapes but the same disklist as the normal configuration (e.g.
1477 symlink them together). Copy amanda.conf, setting all dumpcycle values to 0 and
1478 record to no, e.g. in the global dumptype. If a changer is used, set runtapes
1479 very high so tape capacity is not a planning restriction. Disable the normal
1480 Amanda run, or set the hold file as described in "Operating Amanda", so Amanda
1481 does not try to process the same client from two configurations at the same
1482 time.
1483
1484 Adjust Parallelism
1485
1486 Amanda starts several dumper processes and keeps as many as possible running at
1487 once. The following options control their activity:
1488
1489
1490   inparallel
1491       Total number of dumpers.
1492
1493   maxdumps
1494       Maximum dumpers for a single client.
1495
1496 The default maxdumps is one, meaning only one dumper is assigned to a client at
1497 a time. If a client can support the load, increase maxdumps so more than one
1498 dump on that client is running at once. Note that maxdumps is both a general
1499 amanda.conf parameter and a specific dumptype parameter. The value in a
1500 specific dumptype takes precedence.
1501 Field four of the disklist file is a "spindle number". Areas with the same non-
1502 negative spindle number are not backed up at the same time if maxdumps is
1503 greater than one. This prevents thrashing on an individual physical disk. Set
1504 spindle number to -1 (which is the default) for independent areas that can be
1505 done in conjunction with any other area, such as a whole physical disk. If the
1506 tape server has multiple network connections, an amanda.conf interface section
1507 may be set up for each one and clients allocated to a particular interface with
1508 field five of the disklist. Individual interfaces take precedence over the
1509 general netusage bandwidth limit and follow the same guidelines described above
1510 in "Configuring Amanda": the limit is imposed when deciding whether to start a
1511 dump, but once a dump starts, Amanda lets underlying network components do any
1512 throttling.
1513 Individual Amanda interface definitions do not control which physical
1514 connection is used. That is left up to the operating system network software.
1515 While it's common to give an Amanda interface definition the same name as a
1516 physical connection, e.g. le0, it might be better to use logical names such as
1517 back-door-atm to avoid confusion.
1518 The starttime dumptype parameter delays a backup some amount of time after
1519 Amanda is started. The value is entered as HHMM, so 230, for instance, would
1520 wait 2.5 hours. This may be used to delay backups of some areas until they are
1521 known to be idle.
1522
1523 Monitor for Possible Improvements
1524
1525 amstatus may be used to get a summary of dumper activity:
1526
1527         
1528         # su amanda -c "amstatus Daily --file amdump.1 --summary"
1529         ...
1530          dumper0  busy  :  5:52:01  ( 98.03%)
1531          dumper1  busy  :  0:23:09  (  6.45%)
1532          dumper2  busy  :  0:13:27  (  3.75%)
1533          dumper3  busy  :  0:16:13  (  4.52%)
1534          dumper4  busy  :  0:06:40  (  1.86%)
1535          dumper5  busy  :  0:03:39  (  1.02%)
1536            taper  busy  :  3:54:20  ( 65.26%)
1537           0 dumpers busy  :  0:03:21  (  0.93%)             file-too-large:  0:03:21
1538   (100.00%)
1539         1 dumper  busy  :  4:03:22  ( 67.78%)         no-diskspace:  3:40:55
1540   (     90.77%)
1541                                                     file-too-large:  0:21:13  ( 
1542   8.72%)
1543                                                       no-bandwidth:  0:01:13  (  0.50%)
1544         2 dumpers busy  :  0:17:33  (  4.89%)         no-bandwidth:  0:17:33
1545   (100.00%)
1546         3 dumpers busy  :  0:07:42  (  2.14%)         no-bandwidth:  0:07:42
1547   (100.00%)
1548         4 dumpers busy  :  0:02:05  (  0.58%)         no-bandwidth:  0:02:05
1549   (100.00%)
1550         5 dumpers busy  :  0:00:40  (  0.19%)         no-bandwidth:  0:00:40
1551   (100.00%)
1552         6 dumpers busy  :  0:03:33  (  0.99%)             not-idle:  0:01:53
1553   (     53.10%)
1554                                                         no-dumpers:  0:01:40
1555   ( 46.90%)
1556         
1557         
1558
1559 This says:
1560
1561 * dumper 0 was busy almost all the time.
1562 * dumper 1 (and above) were not used very much.
1563 * taper was busy about 2/3 of the total run time.
1564 * All dumpers were idle less than 1% of the total runtime.
1565 * One dumper was busy 67.78% of the total run time and the reason two dumpers
1566   were not started when one was busy was not enough holding disk space (no-
1567   diskspace) 90.77% of that time, the next image to dump was too large to fit
1568   in the holding disk at all (file-too-large) 8.72% of that time and network
1569   bandwidth was exhausted (no-bandwidth) 0.50% of that time
1570
1571 This configuration would benefit from additional holding disk space, which
1572 would allow more dumpers to run at once and probably keep taper busy more of
1573 the time.
1574 Other common status indicators are:
1575
1576
1577   not-idle
1578       Everything is running that can be.
1579
1580   no-dumpers
1581       All dumpers are busy and there are other dumps that could be started.
1582
1583   client-constrained
1584       The maximum number of dumpers for remaining clients are already running,
1585       or all spindles are already in use.
1586
1587   start-wait
1588       All remaining dumps are delayed until a specific time of day.
1589
1590 If the tape server machine has multiple tape drives, more than one Amanda
1591 configuration may run at the same time. Clients and holding disks should be
1592 assigned to only one configuration, however.
1593 Amanda waits a fixed amount of time for a client to respond with dump size
1594 estimates. The default is five minutes per area on the client. For instance, if
1595 a client has four areas to back up (entries in disklist), Amanda waits at most
1596 20 minutes for the estimates. During dumping, Amanda aborts a dump if the
1597 client stops sending data for 30 minutes. Various conditions, such as slow
1598 clients, which dump program is used and characteristics of the area, may cause
1599 timeouts. The values may be changed with the amanda.conf etimeout parameter for
1600 estimates and dtimeout for data. Positive etimeout values are multiplied by the
1601 number of areas. The absolute value of a negative number is used for the whole
1602 client regardless of the number of areas.
1603
1604 Excluding Files
1605
1606 GNU-tar can exclude items from the dump image based on file name patterns
1607 controlled by the dumptype exclude parameter. A single pattern may be put on
1608 the exclude line itself or multiple patterns may be put in a file on the
1609 client. The dumptype exclude line in that case includes a list keyword and the
1610 path to the file.
1611 Exclusion entries are shell-style wildcard expressions except * matches through
1612 any number of / characters. If a matched item is a directory, it and all its
1613 contents are omitted. For instance:
1614
1615
1616   ./usr
1617       Omit the usr directory at the top level of the area and everything under
1618       it.
1619
1620   core
1621       Omit all items named core.
1622
1623   */core*
1624       Omit all items starting with core, e.g. core, core19970114, corespondent,
1625       or corexx/somefile (probably not a good idea).
1626
1627   */test*.c
1628       Omit all items starting with test and ending with .c, e.g. test.c,
1629       testing.c or testdir/pgm/main.c (probably not a good idea).
1630
1631   *.o
1632       Omit all items ending with .o.
1633
1634   */OLD/*
1635       Omit all items within directories named OLD, including subdirectories and
1636       their contents, but dump the OLD directory entry itself.
1637
1638
1639 Restoring with Amanda
1640
1641 Remember that no one cares if you can back up ?only if you can restore.
1642
1643 Configuring and Using amrecover
1644
1645 One way to restore items with Amanda is with amrecover on the client. Before
1646 amrecover can work, Amanda must run with the dumptype index parameter set to
1647 yes and the amindexd and amidxtaped services must be installed and enabled to
1648 inetd, usually on the tape server machine (the default build sequence installs
1649 them). Also, add the client to .amandahosts (or .rhosts) for the Amanda user on
1650 the server machine. Since amrecover must run as root on the client, the entry
1651 must list root as the remote user, not the Amanda user. amrecover should not be
1652 made setuid-root because it would open up catalogues of the entire system to
1653 everyone.
1654 For this example, user jj has requested two files, both named molecule.dat, in
1655 subdirectories named work/sample-21 and work/sample-22 and said they want the
1656 versions last modified on the 13th of January. Become root on the client, cd to
1657 the area and start amrecover:
1658
1659         
1660           $ su
1661           Password:
1662           # cd ~jj
1663           # amrecover Daily
1664           AMRECOVER Version 2.4.1p1.
1665           Contacting server on amanda.cc.purdue.edu ...
1666           220 amanda Amanda index server (2.4.1p1) ready.
1667           200 Access OK
1668           Setting restore date to       today (1999-01-18)
1669           200 Working date set to 1999-01-18.
1670           200 Config set to Daily.
1671           200 Dump host set to pete.cc.purdue.edu.
1672           $CWD '/home/pete/u66/jj' is on disk '/home/pete/u66' mounted at '/home/
1673   pete/u66'.
1674           200 Disk set to /home/pete/u66.
1675           amrecover>
1676         
1677         
1678
1679 At this point, a command line interface allows browsing the image catalogues.
1680 Move around with the cd command, see what is available with ls, change date
1681 with setdate, add files and directories to the extraction list with add and so
1682 on. The extract command starts actual recovery:
1683
1684         
1685               amrecover> setdate ---14
1686               200 Working date set to 1999-01-14.
1687               amrecover> cd work/sample-21
1688               /home/pete/u66/jj/work/sample-21
1689               amrecover> add molecule.dat
1690               Added /jj/work/sample-21/molecule.dat
1691               amrecover> cd ../sample-22
1692               /home/pete/u66/jj/work/sample-22
1693               amrecover> add molecule.dat
1694               Added /jj/work/sample-22/molecule.dat
1695               amrecover> extract
1696               Extracting files using tape drive /dev/rmt/0mn on host
1697   amanda.cc.purdue.edu.
1698               The following tapes are needed: Daily-034
1699
1700               Restoring files into directory /home/pete/u66
1701               Continue? [Y/n]: y
1702
1703               Load tape Daily-034 now
1704               Continue? [Y/n]: y
1705               Warning: ./jj: File exists
1706               Warning: ./work: File exists
1707               Warning: ./work/sample-21: File exists
1708               Warning: ./work/sample-22: File exists
1709               set owner/mode for '.'? [yn] n
1710               amrecover> quit
1711         
1712         
1713
1714 amrecover finds which tapes contain the images, prompts through mounting them
1715 in the proper order, searches the tape for the image, optionally decompresses
1716 it, brings it across the network to the client and pipes it into the
1717 appropriate restore program with the arguments needed to extract the requested
1718 items. amrecover does not know how to run every client restore program. See the
1719 amrecover manpage for current information. amrecover should not be used to do
1720 full filesystem recovery with vendor restore tools, but does work with GNU-tar.
1721 Vendor tools should be run with the r flag for a full recovery and amrecover is
1722 oriented toward extracting individual items with the x flag. Full filesystem
1723 recovery with vendor restore should be done with amrestore. amrecover (actually
1724 the amidxtaped server) does not know about tape changers, so mount the tapes by
1725 hand or use amtape if a changer is available.
1726
1727 Using amrestore
1728
1729 The amrestore command retrieves whole images from tape. First, find which tapes
1730 have the desired images. The find suboption of amadmin generates output like
1731 this (abbreviated):
1732
1733         
1734             # su amanda -c "amadmin Daily find pete u66"
1735             Scanning /amanda...
1736
1737             date       host                 disk              lv tape or file   file
1738   status
1739             ...
1740             1999-01-12 pete.cc.purdue.edu   /home/pete/u66    1  Daily-032        14
1741   OK
1742             1999-01-13 pete.cc.purdue.edu   /home/pete/u66    1  Daily-033        26
1743   OK
1744             1999-01-14 pete.cc.purdue.edu   /home/pete/u66    1  Daily-034        40
1745   OK
1746             1999-01-15 pete.cc.purdue.edu   /home/pete/u66    1  Daily-000        34
1747   OK
1748             1999-01-16 pete.cc.purdue.edu   /home/pete/u66    1  Daily-001        31
1749   OK
1750             1999-01-17 pete.cc.purdue.edu   /home/pete/u66    0  Daily-002        50
1751   OK
1752             1999-01-18 pete.cc.purdue.edu   /home/pete/u66    1  Daily-003        20
1753   OK
1754         
1755         
1756
1757 The Scanning /amanda... message says amadmin looked in the holding disk (/
1758 amanda) for any images left there. It then lists all tapes or files in the
1759 holding disk that contain the requested area.
1760 The info suboption to amadmin shows tapes with the most recent images:
1761
1762         
1763             # su amanda -c "amadmin Daily info pete u66"
1764             Current info for pete.cc.purdue.edu /home/pete/u66:
1765             Stats: dump rates (kps), Full:  652.0, 648.0, 631.0
1766                               Incremental:  106.0, 258.0, 235.0
1767                     compressed size, Full: -100.0%,-100.0%,-100.0%
1768                               Incremental: -100.0%,-100.0%,-100.0%
1769             Dumps: lev datestmp  tape             file   origK   compK secs
1770                     0  19990117  Daily-002          50  582239  582272  892
1771                     1  19990118  Daily-003          20    3263    3296   31
1772                     2  19981214  Daily-032          21    7039    7072   37
1773         
1774         
1775
1776 Old information may appear, such as 19981214 (14-Dec-1998) in this example.
1777 While it's true this was the last level 2 dump of this area, it is of little
1778 interest because at least one full and level 1 dump have been done since then.
1779 The compressed size values here may be ignored because this particular
1780 configuration uses hardware compression so no software compression data are
1781 available.
1782 A third way to know what tape has an image is to generate a tape table of
1783 contents with amtoc after each Amanda run:
1784
1785         
1786             #  partition                        lvl  size[Kb]  method
1787             0  Daily-002                          -         -  19990117
1788             1  boiler.cc.purdue.edu:/usr/local    1        31  normal
1789             2  egbert.cc.purdue.edu:/opt          1       127  normal
1790             3  boiler.cc.purdue.edu:/usr          1        95  normal
1791            ...
1792            50 pete.cc.purdue.edu:/home/pete/u66   0    582239  normal
1793            ...
1794         
1795         
1796
1797 A printed report similar to the amtoc output may be automatically generated by
1798 amreport for each run with the lbl-templ tapetype parameter in amanda.conf
1799 using the example/3hole.ps template.
1800 The find and info suboptions to amadmin need the Amanda log files and database.
1801 These are not usually large amounts of information and a copy should be pushed
1802 after each amdump run to an alternate machine that also has the Amanda tape
1803 server software installed so they are available if the primary tape server
1804 machine dies. Tools like rdist (ftp://usc.edu/pub/rdist/) or rsync (ftp://
1805 samba.anu.edu.au/pub/rsync/) are useful.
1806 If Amanda was built using --with-db=text (the default), the database is stored
1807 in a set of text files under the directory listed in the infofile amanda.conf
1808 parameter. Here is the file that matches the above info amadmin output:
1809
1810         
1811             # cd /usr/local/etc/amanda/Daily/curinfo
1812             # cat pete.cc.purdue.edu/_home_pete_u66/info
1813             version: 0
1814             command: 0
1815             full-rate: 652.000000 648.000000 631.000000
1816             full-comp:
1817             incr-rate: 106.000000 258.000000 235.000000
1818             incr-comp:
1819             stats: 0 582239 582272 892 916549924 50 Daily-002
1820             stats: 1 3263 3296 31 916637269 20 Daily-003
1821             stats: 2 7039 7072 37 913614357 21 Daily-032
1822             //
1823         
1824         
1825
1826 The first field of each stats line is the dump level. The last field is the VSN
1827 and the field just before it is the tape file number. The field with the large
1828 number just before that is a Unix epoch time value, which may be converted to
1829 text with this Perl script:
1830
1831         
1832             $ cat epoch.pl
1833             #!/usr/local/bin/perl
1834             use warnings;
1835             use strict;
1836             require 'ctime.pl';
1837             foreach (@ARGV) {
1838               s/,//;
1839               if (m/[a-fA-FxX]/) {
1840                 unless (m/^0[xX]/) {
1841                   $_ = '0x' . $_;
1842                 }
1843                 $_ = oct;
1844               }
1845               print &ctime ($_);
1846             }
1847             exit (0);
1848             $ epoch.pl 916549924
1849             Sun Jan 17 0:12:04 US/East-Indiana 1999
1850         
1851         
1852
1853 Prepositioning the tape to the image with mt fsf may significantly reduce the
1854 time needed to do a restore. Some media contain an index for very fast file
1855 searching compared to the one file at a time scanning done by amrestore. Each
1856 tape location method listed above also shows the tape file. Use that number
1857 with mt fsf after a rewind to position to a particular image.
1858 amrestore takes client, area and date stamp patterns as optional arguments to
1859 search for matching images. Each argument is a grep-style regular expression,
1860 so multiple images may match. This also means an image may need a specific
1861 pattern. For instance:
1862
1863         
1864             # amrestore $TAPE pete /
1865         
1866         
1867
1868 finds not just the root area for the pete client, but images for any client
1869 with pete someplace in the hostname and a slash anywhere in the area name.
1870 Assuming only one client matches pete, the following gets just the root area:
1871
1872         
1873             # amrestore $TAPE pete '^/$'
1874         
1875         
1876
1877 The up arrow (caret) at the beginning says the pattern must start with this
1878 string. The dollar sign at the end says it must end there. The quote marks
1879 around the pattern protect the special characters from shell expansion.
1880 Without flags, amrestore finds every matching image, uncompresses it if needed
1881 and creates a disk file in the current working directory with a name made up of
1882 the client, area and dump level. These images may be used directly by the
1883 client restore program.
1884 amrestore may be used to generate a tape table of contents by giving it a host
1885 pattern that cannot match:
1886
1887         
1888             # mt rewind
1889             # amrestore $TAPE no.such.host
1890         
1891         
1892
1893 As it searches in vain for no.such.host it reports images that are skipped:
1894
1895         
1896             amrestore: 0: skipping start of tape: date 19990117 label Daily-002
1897             amrestore: 1: skipping boiler.cc.purdue.edu._.19990117.1
1898             amrestore: 2: skipping egbert.cc.purdue.edu._opt.19990117.1
1899             amrestore: 3: skipping boiler.cc.purdue.edu._.19990117.1
1900             ...
1901         
1902         
1903
1904 For large images, the p flag writes the first match to standard output, which
1905 may then be piped into the client restore program. This flag is also useful for
1906 moving an image across the network. For instance, here is one way to restore a
1907 file directly from the tape server (amanda.cc.purdue.edu) while logged in to
1908 the client:
1909
1910         
1911             # rsh -n amanda.cc.purdue.edu amrestore -p $TAPE pete
1912         ?'^/$? ' \ | gtar xf - ./the-file
1913         
1914         
1915
1916 Tell vendor restore programs to use a small blocking factor to handle the
1917 arbitrary size chunks of data available through a pipeline:
1918
1919         
1920             # rsh -n amanda.cc.purdue.edu amrestore -p $TAPE pete u66 \ |
1921             ufsrestore -ivbf 2 -
1922         
1923         
1924
1925
1926 Restoring Without Amanda
1927
1928 The Amanda tape format is deliberately simple and restoring data can be done
1929 without any Amanda tools if necessary. The first tape file is a volume label
1930 with the tape VSN and date it was written. It is not in ANSI VOL1 format, but
1931 is plain text. Each file after that contains one image using 32 KByte blocks.
1932 The first block is an Amanda header with client, area and options used to
1933 create the image. As with the volume label, the header is not in ANSI format,
1934 but is plain text. The image follows, starting at the next tape block, until
1935 end of file.
1936 To retrieve an image with standard Unix utilities if amrestore is not
1937 available, position the tape to the image, then use dd to read it:
1938
1939         
1940             # mt rewind
1941             # mt fsf NN
1942             # dd if=$TAPE bs=32k skip=1 of=dump_image
1943         
1944         
1945
1946 The skip=1 option tells dd to skip over the Amanda file header. Without the of=
1947 option, dd writes the image to standard output, which can be piped to the
1948 decompression program, if needed, and then to the client restore program.
1949 Since the image header is text, it may be viewed with:
1950
1951         
1952             # mt rewind
1953             # mt fsf NN
1954             # dd if=$TAPE bs=32k count=1
1955         
1956         
1957
1958 In addition to describing the image, it contains text showing the commands
1959 needed to do a restore. Here's a typical entry for the root filesystem on
1960 pete.cc.purdue.edu. It is a level 1 dump done without compression using the
1961 vendor ufsdump program:
1962
1963         
1964         
1965               Amanda: FILE 19981206 pete.cc.purdue.edu / lev 1
1966               comp N program /usr/sbin/ufsdump
1967         
1968         
1969         
1970
1971 To restore, position the tape at start of file and run:
1972
1973         
1974             # dd if=$TAPE bs=32k skip=1 | /usr/sbin/ufsrestore -f... -
1975         
1976         
1977
1978 As with any backup system, test these procedures while in normal production so
1979 the principles and techniques are familiar when disaster strikes.
1980
1981 Note
1982
1983 Refer to http://www.amanda.org/docs/using.html for the current version of this
1984 document.
1985 -------------------------------------------------------------------------------
1986
1987 Prev                           Up                     Next
1988 Part IV. Various Information  Home  Chapter 19. Amanda FAQ
1989