Imported Upstream version 2.5.2p1
[debian/amanda] / docs / indexing.txt
1
2 Chapter 4. Indexing with Amanda
3 Prev  Part I. Installation  Next
4
5 -------------------------------------------------------------------------------
6
7 Chapter 4. Indexing with Amanda
8
9
10 Alan M. McIvor
11
12 Original text
13
14 Stefan G. Weichinger
15
16 XML-conversion;Updates
17 AMANDA Core Team
18 <sgw@amanda.org>
19 Table of Contents
20
21
22   Database_Format
23
24   Database_Browsing
25
26   File_Extraction
27
28   Protocol_Between_amindexd_and_amrecover
29
30   Installation_Notes
31
32   Permissions
33
34   Changes_from_amindex-1.0
35
36   Changes_from_amindex-0.3
37
38   Changes_from_amindex-0.2
39
40   Changes_from_amindex-0.1
41
42   Changes/additions_to_2.3.0
43
44   Known_Bugs
45
46 This file describes how the index files are generated and how amrecover is
47 used.
48
49  Database Format
50
51 The database consists of a directory tree of the format: $host/$disk/
52 $date_$level.gz
53 The host and disk are those listed in the disklist file, the "$host/$disk/" is
54 like the curinfo database, '/' are changed for '_'. There is an index file for
55 each dump, the name of the file is made of the date and the level, they will
56 have the .gz suffix if they are compressed with gzip.
57 ex. The file foo/_usr/19991231_0.gz is the index of the level 0 made on
58 19991231 of the disk /usr of the host foo.
59 The files are ASCII text files containing a list of the directory and files of
60 the dump, one per line. Each entry is the filename relative to the mount point,
61 starting with a /, e.g., /home/user1/data from the disk mounted on /home would
62 generate the entry /user1/data. The index files are stored in compressed format
63 (eg gzip or compress).
64
65  Database Browsing
66
67 The client is called amrecover and is loosely based on the functionality of the
68 program recover from Backup Copilot. A user starts up amrecover. This requires
69 specifying the index server and the Amanda config name (defaults for both are
70 compiled in as part of the installation). Then the user has to specify the name
71 of the host information is wanted about, the disk name, and (optionally) the
72 disk mount point. Finally a date needs to be specified. Given all this, the
73 user can then roam around a virtual file system using ls and cd much like in a
74 FTP client. The file system contains all files backed up on the specified date,
75 or before that date, back to the last level 0 backup. Only the most recent
76 version of any file is shown.
77 As the file system is traversed, the user can add and delete files to a
78 "shopping list", and print the list out.
79
80  File Extraction
81
82 When a user has built up a list of files to extract, they can be extracted by
83 issuing the command extract within amrecover.
84 Files are extracted by the following, for each different tape needed.
85 As part of the installation, a "tape server" daemon amidxtaped is installed on
86 one or more designated hosts, which have an attached tape drive. This is used
87 to read the tapes. See the config files for the options for specifying a
88 default.
89 amrecover contacts amidxtaped on the tape server host specifying which tape
90 device to use, which host and disk files are needed for. On the tape server
91 host, amidxtaped executes amrestore to get the dump image file off the tape,
92 and returns the data to amrecover.
93 If dumps are stored compressed for the client, then amrecover pipes the data
94 through the appropriate uncompression routine to uncompress it before piping it
95 into restore, which then extracts the required files from the dump image.
96 Note that a user can only extract files from a host running the same operating
97 system as he/she is executing amrecover on, since the native dump/restore tools
98 are used - unless GNU-tar is used.
99
100  Protocol Between amindexd and amrecover
101
102 The protocol talked between amindexd and amrecover is a simple ASCII chat
103 protocol based on that used in FTP. amrecover sends a 1 line command, and
104 amindexd replies with a 1 line or multi-line reply. Each line of the reply
105 starts with a three digit code, starting with a '5' if an error occurred. For 1
106 line replies, and the last line of a multi-line reply, the 4th character is a
107 space. For all but the last line of a multi-line reply, the 4th character is a
108 '-'.
109 The commands and replies other than acknowledgments are:
110 Table 4.1. Protocol between amindexd and amrecover
111  ____________________________________________________________________________
112 |QUIT_______________|finish_up_and_close_connection__________________________|
113 |HOST_<host>________|set_host_to_host________________________________________|
114 |DISK_<disk>________|set_disk_to_disk________________________________________|
115 |LISTDISK_[<device>]|list_the_disks_for_the_current_host_____________________|
116 |SCNF_<config>______|set_Amanda_configuration_to_config______________________|
117 |DATE_<date>________|set_date_to_date________________________________________|
118 |DHST_______________|return_dump_history_of_current_disk_____________________|
119 |                   |Opaque is directory? query. Is the directory dir present|
120 |OISD <dir>         |in the backups of the current disk back to and including|
121 |___________________|the_last_level_0_dump.__________________________________|
122 |                   |Opaque list directory. Give all filenames present in dir|
123 |OLSD <dir>         |in the backups of the current disk back to and including|
124 |___________________|the_last_level_0_dump.__________________________________|
125 |                   |Opaque recursive list directory. Give all filenames     |
126 |ORLD <dir>         |present in dir and subdir in the backups of the current |
127 |___________________|disk_back_to_and_including_the_last_level_0_dump._______|
128 |TAPE_______________|return_value_of_tapedev_from_amanda.conf_if_set.________|
129 |DCMP               |returns "YES" if dumps for disk are compressed, "NO" if |
130 |___________________|dumps_aren't.___________________________________________|
131
132
133
134  Installation Notes
135
136
137   1. Whether or not an index is created for a disk is controlled by a disk
138      configuration option index. So, in amanda.conf you need to define a
139      disktype with this option, e.g.,
140
141        define dumptype comp-user-index {
142        comment "Non-root partitions on reasonably fast machines"
143        compress client fast
144        index yes
145        priority medium
146        }
147
148   2. You need to define disks that you want to generate an index for to
149      be of one of the disktypes you defined which contain the index option.
150      This cause sendbackup-dump on the client machine to generate an index file
151      which is stored local to the client, for later recovery by amgetidx (which
152      is called by amdump).
153   3. Amanda saves all the index files under a directory specified by
154      "indexdir" in amanda.conf. You need to create this directory by hand. It
155      needs to have read/write permissions set for the user you defined to run
156      Amanda.
157      If you are using the "text database" option you may set indexdir and
158      infofile to be the same directory.
159   4. The index browser, amrecover, currently gets installed as part of the
160      client software. Its location may not be appropriate for your system and
161      you may need to move it to a more accessible place such as /usr/local/bin.
162      See its man page for how to use it.
163      Note that amindexd, amgetidx, amidxtaped, and amtrmidx all write debug
164      files on the server in /tmp (unless this feature is disabled in the source
165      code), which are useful for diagnosing problems. amrecover writes a debug
166      file in /tmp on the machine it is invoked.
167
168
169  Permissions
170
171 The userid chosen to run the Amanda client code must have permission to run
172 restore since this is used by createindex-dump to generate the index files.
173 For a user to be able to restore files from within amrecover, that user must
174 have permission to run restore.
175
176  Changes from amindex-1.0
177
178 Get index directory from amanda.conf.
179 Integration into Amanda-2.3.0.4.
180 Rewriting of amgetidx to use amandad instead of using rsh/rcp.
181
182  Changes from amindex-0.3
183
184 Support for index generation using GNU-tar.
185 Support for restoring files from within amrecover.
186 Bug fixes:
187
188 * index/client/amrecover.c (guess_disk): Removed inclusion of mntent.h and use
189   of MAXMNTSTR since this was non-portable, as pointed out by Izzy Ergas
190   <erga00@nbhd.org>.
191
192
193 * index/client/display_commands.c (list_directory): Removed point where
194   list_directory() could sleep for ever waiting for input that wasn't going to
195   come.
196
197
198 * index/server/amindexd.c index/client/uscan.l Installed patches from Les
199   Gondor <les@trigraph.on.ca> to make amrecover handle spaces in file names.
200
201
202 * server-src/amcontrol.sh: As pointed out by Neal Becker <neal@ctd.comsat.com>
203   there were still a few sh-style comments that needed conversion to c-style.
204
205
206  Changes from amindex-0.2
207
208
209 * index/client/Makefile.in
210 * index/client/help.c
211 * index/client/amrecover.h
212 * index/client/uparse.y
213 * index/client/uscan.l Added a help command.
214
215
216 * index/client/set_commands.c: set_disk() and set_host() now check for empty
217   extract list.
218
219
220 * index/client/extract_list.c:
221 * index/client/amrecover.h:
222 * index/client/uparse.y:
223 * index/client/uscan.l: Added clear extract list command.
224
225
226 * index/client/set_commands.c (set_disk): Added code so working directory set
227   to mount point.
228
229
230 * index/client/extract_list.c: If the last item on a tape list is deleted, the
231   tape list itself is now deleted from the extract list.
232
233
234 * index/client/amrecover.c:
235 * index/server/amindex.c: If the server started up and found that the index dir
236   doesn't exist, then it exited immediately and the client got informative
237   message. Corrected this so it is obvious what is wrong to the user, since
238   this is most likely to occur when somebody is setting up for the first time
239   and needs all the help they can get.
240
241
242 * server-src/amgetidx.c Added patch from Pete Geenhuizen
243   <pete@gasbuggy.rockledge.fl.us> so that it works even when remote shell is
244   csh.
245
246
247 * server-src/amcontrol.sh
248 * server-src/Makefile.in Amcontrol is now parameterized like other scripts and
249   run through munge to generate installable version.
250
251
252 * index/server/amindexd.c (main): Added code to set userid if FORCE_USERID set.
253
254
255 * index/server/amindexd.c Removed #define for full path of grep. Assumed now to
256   be on path.
257
258
259 * client-src/createindex-dump.c
260 * client-src/sendbackup-dump.c
261 * man/Makefile.in Added patch from Philippe Charnier <charnier@lirmm.fr> so
262   they work when things are installed with version numbers. This was also
263   reported by Neal Becker <neal@ctd.comsat.com>. Also patch to set installed
264   man page modes and create directory if needed.
265
266
267 * config/options.h-sunos4 Corrected definition for flex library.
268
269
270 * server-src/amtrmidx.c Added some pclose() commands, used remove() instead of
271   system("rm .."). Problems reported by Pete Geenhuizen
272   (<pete@gasbuggy.rockledge.fl.us>) on a system with small ulimits set.
273
274
275 * index/server/amindexd.[ch]
276 * index/server/list_dir.c
277 * index/client/amrecover.c
278 * index/client/set_commands.c
279 * index/client/uparse.y Changes developed with the help of Pete Geenhuizen
280   <pete@gasbuggy.rockledge.fl.us> to support disks specified by logical names.
281   Also, now debug files generated by amrecover include PID so multiple users
282   can use amrecover simultaneously and without file deletion permission
283   problems.
284
285
286 * config/config.h-hpux:
287 * config/config-common.h:
288 * server-src/amgetidx.c: Changes from Neal Becker re remote shell, making it a
289   configuration parameter.
290
291
292 * config/options.h-sunos4 Had -Lfl instead of -lfl
293
294
295  Changes from amindex-0.1
296
297
298 * index/client/uscan.l: added support for abbreviated date specs
299
300
301 * index/client/amrecover.c (guess_disk): guess_disk got disk_path wrong if
302   mount point other than / (as subsequently pointed out by Eir Doutreleau
303   <ed@cti.ecp.fr>)
304
305
306 * server-src/amtrmidx: Added amtrmidx which removes old index files.
307
308
309 * index/client: Added a pwd command
310
311
312 * server-src/amgetidx.c (main): Added use of CLIENT_LOGIN username on r
313   commands. (as pointed out by Eric Payan <Eric.Payan@ufrima.imag.fr>)
314
315
316 * server-src/amgetidx.c: Bug: It was copying from all clients irrespective of
317   whether the client was configured for indices. A '}' in the wrong place.
318
319
320 * server-src/amgetidx.c: Removed user configuration section. Instead include
321   amindexd.h to get information.
322
323
324  Changes/additions to 2.3.0
325
326 common-src/conffile.[ch]
327
328 * added "index" as a valid option
329
330 server-src/driverio.c
331
332 * added code to optionstr() to write "index" into option string
333
334 client-src/sendback-dump.c
335
336 * added code to generate index if requested.
337
338 client-src/indexfilename.[ch] client-src/createindex-dump.c
339
340 * code to generate index.
341
342 client-src/Makefile.in
343
344 * a new target. Another file for sendbackup-dump
345
346 config/config-common.h
347
348 * added def of restore.
349
350
351  Known Bugs
352
353
354 * Empty directories don't get into the listing for a dump (at all dump levels).
355
356
357 * When amrecover starts up, it tries to guess the disk and mount point from the
358   current directory of the working system. This doesn't work for disks
359   specified by logical names, nor when an automounter is being used, or a link
360   is in the path.
361
362
363 Note
364
365 Refer to http://www.amanda.org/docs/indexing.html for the current version of
366 this document.
367 -------------------------------------------------------------------------------
368
369 Prev                   Up                                     Next
370 Chapter 3. Excluding  Home  Chapter 5. Backup PC hosts using Samba
371