Amanda Index: Difference between revisions

From wiki.zmanda.com
Jump to navigation Jump to search
(→‎File Extraction: In Amanda 2.5.0 amidxtaped reads tapes instead of using amrestore like in 2.4.X)
Line 82: Line 82:
* You need to define disks that you want to generate an index for to be of one of the disktypes you defined which contain the index option. This cause sendbackup-dump on the client machine to generate an index file which is stored local to the client, for later recovery by amgetidx (which is called by amdump).
* You need to define disks that you want to generate an index for to be of one of the disktypes you defined which contain the index option. This cause sendbackup-dump on the client machine to generate an index file which is stored local to the client, for later recovery by amgetidx (which is called by amdump).


* AMANDA saves all the index files under a directory specified by "indexdir" in [[amanda.conf]]. You need to create this directory by hand. It needs to have read/write permissions set for the user you defined to run AMANDA. If you are using the "text database" option you may set indexdir and infofile to be the same directory.
* AMANDA saves all the index files under a directory specified by "indexdir" in [[amanda.conf]]. In some versions of AMANDA, you need to create this directory by hand. It needs to have read/write permissions set for the user you defined to run AMANDA. If you are using the "text database" option you may set indexdir and infofile to be the same directory.


* The index browser, amrecover, currently gets installed as part of the client software. Its location may not be appropriate for your system and you may need to move it to a more accessible place such as /usr/local/bin. See its man page for how to use it.
* The index browser, amrecover, currently gets installed as part of the client software. Its location may not be appropriate for your system and you may need to move it to a more accessible place such as /usr/local/bin. See its man page for how to use it.

Revision as of 21:36, 28 July 2006

Database Format

The database consists of a directory tree of the format: $host/$disk/$date_$level.gz

The host and disk are those listed in the disklist file, the "$host/$disk/" is like the curinfo database, '/' are changed for '_'. There is an index file for each dump, the name of the file is made of the date and the level, they will have the .gz suffix if they are compressed with gzip.

The file "foo/_usr/19991231_0.gz" is the index of the level 0 made on 19991231 of the disk "/usr" of the host "foo".

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. The index files are stored in compressed format (eg gzip or compress).

Database Browsing

The client is called amrecover and is loosely based on the functionality of the program recover from Backup Copilot. A user starts up amrecover. This requires specifying the index 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 information is wanted about, the disk name, and (optionally) the disk mount point. Finally a date needs to be specified. Given all this, the user can then roam around a 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. Only the most recent version of any file is shown.

As the file system is traversed, the user can add and delete files to a "shopping list", and print the list out.


File Extraction

When a user has built up a list of files to extract, they can be extracted by issuing the command extract within amrecover.

Files are extracted by the following, for each different tape needed.

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.

amrecover contacts amidxtaped on the tape server host specifying which tape device to use, which host and disk files are needed for.

  • Amanda 2.4.X: On the tape server host, amidxtaped executes amrestore to get the dump image file off the tape, and returns the data to amrecover.
  • Amanda 2.5.X: On the tape server host, amidxtaped reads the dump files itself, eventually contacting amrecover with instructions for the user to load the next tape.

If dumps are stored compressed for 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.

Note that a user can only extract files from a host running the same operating system as he/she is executing amrecover on, since the native dump/restore tools are used - unless GNU-tar is used.

Protocol Between amindexd and amrecover

The protocol talked between amindexd and amrecover is a simple ASCII chat protocol based on that used in FTP. amrecover sends a 1 line command, and amindexd replies with a 1 line or multi-line reply. Each line of the reply starts with a three digit code, starting with a '5' if an error occurred. For 1 line replies, and the last line of a multi-line reply, the 4th character is a space. For all but the last line of a multi-line reply, the 4th character is a '-'.

The commands and replies other than acknowledgments are:

Command Description
Protocol between amindexd and amrecover
QUIT finish up and close connection
HOST <host> set host to host
DISK <disk> set disk to disk
LISTDISK [<device>] list the disks for the current host
SCNF <config> set AMANDA configuration to config
DATE <date> set date to date
DHST return dump history of current disk
OISD <dir> Opaque is directory? query. Is the directory dir present in the backups of the current disk back to and including the last level 0 dump.
OLSD <dir> Opaque list directory. Give all filenames present in dir in the backups of the current disk back to and including the last level 0 dump.
ORLD <dir> Opaque recursive list directory. Give all filenames present in dir and subdir in the backups of the current disk back to and including the last level 0 dump.
TAPE return value of tapedev from amanda.conf if set.
DCMP returns "YES" if dumps for disk are compressed, "NO" if dumps aren't.

Configuration

  • Whether or not an index is created for a disk is controlled by a disk configuration option "index". So, in amanda.conf you need to define a disktype with this option, e.g.,
define dumptype comp-user-index {
            comment "Non-root partitions on reasonably fast machines"
            compress client fast
            index yes
            priority medium
}
  • You need to define disks that you want to generate an index for to be of one of the disktypes you defined which contain the index option. This cause sendbackup-dump on the client machine to generate an index file which is stored local to the client, for later recovery by amgetidx (which is called by amdump).
  • AMANDA saves all the index files under a directory specified by "indexdir" in amanda.conf. In some versions of AMANDA, you need to create this directory by hand. It needs to have read/write permissions set for the user you defined to run AMANDA. If you are using the "text database" option you may set indexdir and infofile to be the same directory.
  • The index browser, amrecover, currently gets installed as part of the client software. Its location may not be appropriate for your system and you may need to move it to a more accessible place such as /usr/local/bin. See its man page for how to use it.

Note that amindexd, amgetidx, amidxtaped, and amtrmidx all write debug files on the server in /tmp/amanda (unless this feature is disabled in the source code), which are useful for diagnosing problems. amrecover writes a debug file in /tmp/amanda on the machine it is invoked.

The debug directory, usualy /tmp/amanda, is hardcoded at compile time can be found by running "amadmin x version".

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 is done on the tape.

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

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.