Taper scan algorithm

From The Open Source Backup Wiki (Amanda, MySQL Backup, BackupPC)
Revision as of 02:36, 28 March 2009 by Pyeatman (talk | contribs)
Jump to navigationJump to search

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 = AI, PI, and AI = ∅.

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'.