SITE
  Documentation
  Download
  License
  Performance
  Mailing List

FACADE
  Documentation
  Download
  License
  Mailing List

STORE
  Overview
  Tools
  Download
  License
  Mailing List

JUNIT EXTENSIONS
  Documentation
  Download
  License

AMANDA CD-RW
TAPER

  Overview
  Installation & Usage
  Internals

Amanda CDRW-Taper - Internals

1. Goals

  • Amanda keeps track of its "tapes" in a tapelist file. This file must be taken into account to determine which "tapes" are available, and which of these can be overwritten without losing anything important.
  • Amanda keeps a database of which backups are stored on which "tapes". This information should be kept up-to-date.
  • It would be nice if the taper could make use of the existing tape changer API.
  • The taper needs a mode in which it only writes an intermediate directory to a CDRW (optionally deleting the intermediate directory afterwards).
  • To support some form of permanent backup it would be nice to allow burning of intermediate directories to CD-R media (non-rewritable), perhaps even automatically if some empty CD-R media is found in the writer device.

2. The Algorithm

  1. Determine ordered list of "tapes" usable in this run from "tapelist", "runtapes" parameter and the media currently available in the "tapedev" (or in the changer).
  2. Start with an empty list of used "tapes".
  3. As long as we get more WRITE commands:
    1. For PORT-WRITE commands, copy incoming data to a temporary position and take note of the resulting file's size. For FILE-WRITE commands, determine the size of the resulting file.
    2. Find a nice place for it on any of the used "tapes":
      1. Of all the "tapes" in our "used" list, select the one with the smallest empty space that just fits the file.
      2. If no such "tape" can be found, and not all "tapes" in the "usable" list have been used, create a new intermediate directory for the next disk in the "usable" list, mark the "tape" as used and select it.
      3. If all "tapes" in the "usable" list have already been used, delete the temporary copy (if this was a PORT-WRITE), and send an error message to Amanda.
    3. Move/copy the backup data to its new position in the selected intermediate directory.
    4. Report success and the label of the "tape" where the file was stored back to Amanda.
  4. After receiving a QUIT command, if any of the used "tapes" are available in the changer (or in "tapedev"), write the corresponding intermediate directory to the media.
  5. If any directories have not been written to CDRW, and if CDR-media is present in some drive, burn those directories to CDR.
  6. If any errors occur during writing, of if any intermediate disks cannot be written to the backup media, send a notifying message to the Amanda operator.

3. Disk structure

Here is a typical directory listing of a backup CD as an example:

   -r--r--r--  1 amanda  disk         8 Jan  5 17:58 AMANDA_LABEL
   -r--r--r--  1 amanda  disk        64 Jan  5 17:59 server._.1.info
   -r--r--r--  1 amanda  disk     65536 Jan  5 17:59 server._.1.tar.gz
   -r--r--r--  1 amanda  disk        68 Jan  5 17:58 server._home.1.info
   -r--r--r--  1 amanda  disk     32768 Jan  5 17:58 server._home.1.tar.gz

The file AMANDA_LABEL contains the "tape" label, the *.info files hold the 32k header (stripped of trailing NULL-bytes) that Amanda prepends to each dump. The *.tar.gz are the actual dump files.

As shown by the example, the CDRW-Taper takes advantage of the fact that a CD can contain a filesystem: Instead of prepending a 32k header to each dump file which provides information on the file content, the CDRW-Taper puts this information into an extra file. In addition, the CDRW-Taper encodes the most essential information on the dump (namely, the host name, disk name, used dump program and compression type) in the dump's filename.


[ t]ivano software gmbh
http://www.tivano.de/