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