Amanda Index

From wiki.zmanda.com
Jump to navigation Jump to search

Amanda's indexes contain a list of the directories and files in a dump, and are used in restore operations to determine which files are available and on what tapes they are stored.

The index is required for amrecover(8). If the index is not available, the tape can restored using amrestore(8) or using the backup command (gnutar or restore) and dd command.

Database Format

The database consists of a directory tree rooted at indexdir from amanda.conf(5) containing filenames of the format

host/disk/date_level.gz

There is an index file for each dump. The host and disk are those listed in the disklist, formatted like the curinfo database: all '/' characters are changed for '_'. The file will have the .gz suffix if they are compressed with gzip.

As an example, server18/_usr/19991231_0.gz is the index of the level 0 made on 19991231 of the disk /usr of the host server18.

The files are ASCII text files containing a list of the directory and files of the dump, one per line. Each entry is the filename relative to the mount point, starting with a /, e.g., /home/user1/data from the disk mounted on /home would generate the entry /user1/data. Directories must end with a /.

The index files are stored in compressed format (eg gzip or compress).

Configuration

Creation of an index when dumping a disk is controlled by the dumptype option index. For example:

define dumptype comp-user-index {
            #...
            index yes
}

Amanda backups will almost always create indexes. Sometimes indexes are disabled if the administrator knows that recovery will always be from an entire dump.

Index In Action

Dump

During a dump operation, the driver reads three streams of information from the client concurrently: data (the dump itself), messages (errors, warnings, and so on), and the index. The index stream is written (possibly through a compression program) directly to the index file.

NOTE: Previous versions of Amanda used a program called amgetidx to fetch the index; this program is not used in recent versions of Amanda.

Index retention

Amanda keeps the online info and index of a tape until

  • the tape is reused, or
  • the tape (with force flag) rewritten the same label, or
  • amrmtape(8) is done on the tape.

Restore

The tool browse database index is amrecover(8). This requires specifying the index server (amanda server) and the amanda config name (defaults for both are compiled in as part of the installation). Then the user has to specify the name of the host whose backup is being recovered, the disk name, and (optionally) the disk mount point. Finally a date needs to be specified. Given all this, the user can then browse the virtual file system using "ls" and "cd" much like in a FTP client. The file system contains all files backed up on the specified date, or before that date, back to the last level 0 backup.

Amrecover builds this virtual filesystem based on the index files stored on the index server. The communication with the index server uses the amindexd protocol.

As part of the installation, a "tape server" daemon, amidxtaped, is installed on one or more designated hosts, which have an attached tape drive. This is used to read the tapes. See the config files for the options for specifying a default. Files are extracted by the following process, repeated for each required tape:

  1. amrecover contacts amidxtaped on the tape server host specifying which tape device to use, and which host and disk files are needed.
    • Before Amanda 2.5.0: On the tape server host, amidxtaped executes amrestore(8) to get the dump image file off the tape, and streams the data to amrecover(8).
    • Amanda 2.5.0 and later: On the tape server host, amidxtaped reads the dump files itself, eventually contacting amrecover(8) with instructions for the user to load the next tape.
  2. If dumps are stored compressed by the client, then amrecover pipes the data through the appropriate uncompression routine to uncompress it before piping it into restore, which then extracts the required files from the dump image.

Permissions

The userid chosen to run the Amanda client code must have permission to run restore since this is used by createindex-dump to generate the index files.

For a user to be able to restore files from within amrecover, that user must have permission to run restore.

Known Bugs

  • Empty directories don't get into the listing for a dump (at all dump levels).
  • When amrecover starts up, it tries to guess the disk and mount point from the current directory of the working system. This doesn't work for disks specified by logical names, nor when an automounter is being used, or a link is in the path.

Other languages: [[::Amanda Index|English]] {{#ifexist: {{#if: | | {{#if: | :}}Amanda Index}}/Fr |  • {{#if: |français| [[::Amanda Index/Fr|français]]}}|}}

{{#ifexist: {{#if: | | {{#if: | :}}Amanda Index}}/Zh-cn |  • {{#if: |中文(中国大陆)| [[::Amanda Index/Zh-cn|中文(中国大陆)]]}}|}}