Changers

From wiki.zmanda.com
Revision as of 16:02, 27 September 2012 by Laurent Dongradi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This document outlines Amanda's tape changer support. Amanda uses the Changer API to remain device-independent but still support the widest range of tape software and hardware possible. This page links to the various scripts that are available in the Amanda distribution. See Changer API for help writing a new changer script.

Old vs. New

There are two Changer APIs in Amanda right now. The old (1.0) API consisted of some shell scripts that Amanda executed to perform various changer operations, and had a number of limitations described in the developer documentation. The new (2.0) API is implemented entirely in Perl, and supports easier and more consistent configuration (from within amanda.conf), concurrent access to multiple changers and devices. Where possible, you are encouraged to use the new changer API. See amanda-changers(7) in your distribution for information on the old and new changers available to you.

Specifying a Changer

All changer-specific interfaces are hidden by a glue program that the rest of Amanda calls to interact with the tape changer. The name of this changer program is given by the "tpchanger" variable in the file amanda.conf(5). For example:

tpchanger "chg-multi"	   # use multi-unit tape changer emulator

The tapedev parameter is ignored if a tpchanger program is specified, although some changer scripts read the value of tapedev from amanda.conf.

If the tpchanger program does not begin with a '/', Amanda expects it to reside in amlibexecdir, and possibly have the version suffix appended depending on how Amanda was configured.

Two other amanda.conf parameters are available for changer use. However, their function is left entirely up to the changer script itself. These are changerfile and changerdev. Typically changerfile will point to the configuration file specific to the changer, or be a base name of several related changer files. The changerdev parameter may point to the /dev entry used to access the changer device.

See the documentation with the specific changer you're interested in to see exactly how these variables are used (if at all).

Operator interface

You can manipulate the changer using an existing amanda configuration using the amtape(8) command.

amcheck(8) looks for the next tape in the rack the same way the taper does. If multiple tapes are used in one night, amcheck attempts to find all the needed tapes in turn if the tape-changer is random access. On a one-way gravity stacker, amcheck only finds the first tape, since finding the subsequent ones would put the first one out of reach of that night's amdump run.

amrestore(8) does not include any tape changer support directly, as amrestore knows nothing about the amanda.conf files or server-side databases. This is a deliberate decision to keep amrestore independent, so it can be run from any host with a tape drive, even if the original tape server host is down. To use amrestore in a tape-changer environment, use amtape to find the right tape, then run amrestore giving the resulting tape device name.

amrecover(8) will cause the server to use a tape changer if the tape device specified in amrecover matches the string specified by amrecover_changer in amanda.conf. This string is often set to changer, so that a simple

amrecover> setdevice changer

will cause the server to use its changer to supply tapes for recovery.

Amdump Behavior

Amanda does not require a particular tape label for a run. Any label that matches the labelstr regex and is determined to be "inactive" according to the tapelist database, may be written to. However, there is a preferred 'next' tape, the one that is next in the cycle implied by the current tapelist.

amdump uses two algorithms, depending on whether the tape changer can go backwards in the rack or not. If multiple tapes are needed in a single run, this algorithm is repeated in turn whenever a new tape is required.

Normal tape changers (those that can go backwards)
With a full-access tape changer, amdump searches the entire rack for the preferred tape label. This tape will usually be found at the current or next position, but might be located anywhere. If the tape is found, it is used. If it is not found, the first tape encountered that matches the labelstr and is not active is picked.
Gravity stackers (anything that can not go backwards)
To avoid going all the way to the bottom of the stacker only to find that the preferred tape isn't present and nothing can be done, AMANDA picks the first tape (starting at the current position) that matches the labelstr and is not active, regardless of whether it is the preferred tape.

The algorithm is described in detail at Taper scan algorithm.

Amanda-supplied Scripts

See also amanda-changers(7) for authoritative information about changers.


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

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