Taper scan algorithm: Difference between revisions
mNo edit summary |
(add manpage draft) |
||
Line 32: | Line 32: | ||
backup run. You can run the algorithm without running Amanda by doing 'amtape | backup run. You can run the algorithm without running Amanda by doing 'amtape | ||
taper'. | taper'. | ||
== Proposed Manpage == | |||
'''I am working on a manpage to document the taperscan algorithm, as well as make the algorithm selectable in amanda.conf. Here's a draft.''' --[[User:Dustin|Dustin]] 10:27, 12 April 2009 (PDT) | |||
<pre> | |||
AMANDA-TAPERSCAN(7) Miscellanea AMANDA-TAPERSCAN(7) | |||
NAME | |||
amanda-taperscan - Amanda Taperscan Algorithms | |||
DESCRIPTION | |||
Amanda uses a taperscan algorithm to select volumes on which to store | |||
dumps. Historically Amanda has provided only one, fairly complex | |||
taperscan algorithm, but this algorithm did not suit the needs of all | |||
users. Now Amanda offers a wide array of algorithms to suit varied | |||
needs. Adding new algorithms is not difficult. | |||
The taperscan algorithm is specified with the taperscan parameter, | |||
which has a default value of traditional. | |||
Taperscan algorithms are implemented as perl packages with the prefix | |||
Amanda::Taper::Scan::. See the perl documentation for | |||
Amanda::Taper::Scan for more information. | |||
TAPERSCAN ALGORITHMS | |||
In general, these volumes will only select reusable volumes. These are | |||
volumes which are listed in the tapelist(5) with the reuse flag, and | |||
which are not among the tapecycle-1 most recent volumes in the list. | |||
Put another way, reusable volumes do not contain data that must be | |||
retained. Note that if fewer than tapecycle-1 volumes have been written | |||
then there are no reusable volumes. Newly labeled volumes (volumes that | |||
have been labeled with amlabel but never used) are considered reusable. | |||
Many of these algorithms look for the oldest reusable volume. In most | |||
cases, this is the best volume to overwrite, as the data it contains is | |||
older than that on any other volume. If there are no reusable volumes, | |||
then there is no oldest reusable volume. Newly labeled volumes are not | |||
considered when calculating the oldest reusable volume. | |||
traditional | |||
This algorithm duplicates Amanda's historical behavior, and it operates | |||
in two stages. | |||
First, if there is an oldest reusable volume, the algorithm uses the | |||
changer to search for that volume. Note that, because newly labled | |||
volumes are not included in the calculation of the oldest reusable | |||
volume, this search prefers volumes which have been used before to | |||
newly-labeled volumes. | |||
Second, if there is no oldest reusable volume, or if that volume is not | |||
available in the changer, then the algorithm begins a sequential scan | |||
of the changer, starting at the current slot. It selects the first | |||
suitable volume it finds: a reusable volume (perhaps newly-labeled) or, | |||
if label_new_tapes is true, a blank volume. | |||
Note | |||
This algorithm shows an undue preference for volumes already | |||
containing data, by omitting newly-labeled volumes from its first | |||
stage. Historically, many Amanda changer scripts were not | |||
searchable (including chg-disk and, if havereader=0, chg-zd-mtx), | |||
and thus skipped the first stage. Starting with Amanda 2.6.1, all | |||
changers are searchable, so both stages of the algorithm are used. | |||
If this causes an undesirable change in behavior, consider one of | |||
the other taperscan algorithms..sp .5v | |||
SEE ALSO | |||
amanda(8), amanda.conf(5), tapelist(5), amanda-changers(7) | |||
The Amanda Wiki: : http://wiki.zmanda.com/ | |||
AUTHOR | |||
Dustin J. Mitchell <[email protected]> | |||
Zmanda, Inc. (http://www.zmanda.com) | |||
Amanda 2.6.2alpha 04/12/2009 AMANDA-TAPERSCAN(7) | |||
</pre> |
Revision as of 17:27, 12 April 2009
The Taper scan algorithm is the algorithm used to determine which volume, if any, is the next to be written by taper. It applies to a specific amanda configuration, and parameter values are taken from that amanda.conf file. See amanda.conf(5) for individual parameter definitions.
Overview
Those tapes (or volumes) that have been labeled with amlabel and whose labels match the expression in the parameter “labelstr” may be used by this configuration. In addition, if the parameter “label_new_tapes” has been set, any unlabeled tapes (OR non amanda tapes!) may also be used and will be labeled when used.
Among those tapes that may be used by this configuration, those that have already been used, and are among the most recent “tapecycle”-1 to have been used, are considered active. Any tapes that have been used less recently are considered inactive and are elegable to be used again.
The Taper scan algorithm will first select any available labeled but unused tape (or unlabeled tape if “label_new_tapes” has been set). If the algorithm finds no unused tapes, it will select the least recently used tape next, as long as it is not active. If neither of those choices is available, it will select an inactive, used tape. If none of those choices are available (all available tapes are active), then amanda will go into degraded mode.
This algorithm is applied from scratch any time a new tape is needed during a backup run. You can run the algorithm without running Amanda by doing `amtape <conf> taper`.
Details
Consider the set of tapes T. We can partition the set into two disjoint subsets A (the set of active tapes) and I (the set of inactive tapes). Assuming I is nonempty, there exists a subset P of I, called the set of preferred tapes. Note that T = A ∪ I, P ⊆ I, and A ∩ I = ∅.
Amanda will only use tapes from I; active tapes are not considered for overwriting. Also, tapes from P are preferred to other tapes in I; a tape not in P (but in I) will be used only if no tapes in P are available. If no tapes from I are available, then no tapes are used and Amanda will go into degraded mode.
Tapes are assigned to each of the sets as follows:
- Any labeled but unused tapes are in both I and P. This includes unlabeled tapes if the label_new_tapes option is set.
- The most recently used "tapecycle" - 1 number of tapes is in A.
- Any remaining tapes are in I. The single least recently used of these is also in P.
This algorithm is applied from scratch any time a new tape is needed during a backup run. You can run the algorithm without running Amanda by doing 'amtape taper'.
Proposed Manpage
I am working on a manpage to document the taperscan algorithm, as well as make the algorithm selectable in amanda.conf. Here's a draft. --Dustin 10:27, 12 April 2009 (PDT)
AMANDA-TAPERSCAN(7) Miscellanea AMANDA-TAPERSCAN(7) NAME amanda-taperscan - Amanda Taperscan Algorithms DESCRIPTION Amanda uses a taperscan algorithm to select volumes on which to store dumps. Historically Amanda has provided only one, fairly complex taperscan algorithm, but this algorithm did not suit the needs of all users. Now Amanda offers a wide array of algorithms to suit varied needs. Adding new algorithms is not difficult. The taperscan algorithm is specified with the taperscan parameter, which has a default value of traditional. Taperscan algorithms are implemented as perl packages with the prefix Amanda::Taper::Scan::. See the perl documentation for Amanda::Taper::Scan for more information. TAPERSCAN ALGORITHMS In general, these volumes will only select reusable volumes. These are volumes which are listed in the tapelist(5) with the reuse flag, and which are not among the tapecycle-1 most recent volumes in the list. Put another way, reusable volumes do not contain data that must be retained. Note that if fewer than tapecycle-1 volumes have been written then there are no reusable volumes. Newly labeled volumes (volumes that have been labeled with amlabel but never used) are considered reusable. Many of these algorithms look for the oldest reusable volume. In most cases, this is the best volume to overwrite, as the data it contains is older than that on any other volume. If there are no reusable volumes, then there is no oldest reusable volume. Newly labeled volumes are not considered when calculating the oldest reusable volume. traditional This algorithm duplicates Amanda's historical behavior, and it operates in two stages. First, if there is an oldest reusable volume, the algorithm uses the changer to search for that volume. Note that, because newly labled volumes are not included in the calculation of the oldest reusable volume, this search prefers volumes which have been used before to newly-labeled volumes. Second, if there is no oldest reusable volume, or if that volume is not available in the changer, then the algorithm begins a sequential scan of the changer, starting at the current slot. It selects the first suitable volume it finds: a reusable volume (perhaps newly-labeled) or, if label_new_tapes is true, a blank volume. Note This algorithm shows an undue preference for volumes already containing data, by omitting newly-labeled volumes from its first stage. Historically, many Amanda changer scripts were not searchable (including chg-disk and, if havereader=0, chg-zd-mtx), and thus skipped the first stage. Starting with Amanda 2.6.1, all changers are searchable, so both stages of the algorithm are used. If this causes an undesirable change in behavior, consider one of the other taperscan algorithms..sp .5v SEE ALSO amanda(8), amanda.conf(5), tapelist(5), amanda-changers(7) The Amanda Wiki: : http://wiki.zmanda.com/ AUTHOR Dustin J. Mitchell <[email protected]> Zmanda, Inc. (http://www.zmanda.com) Amanda 2.6.2alpha 04/12/2009 AMANDA-TAPERSCAN(7)