Amanda CDRW-Taper - Internals
Peter Conrad, <firstname.lastname@example.org>
Richard Kunze, <email@example.com>
$Id: Internals.html,v 1.1 2003/05/20 10:13:09 conrad Exp $
- 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
- 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
- 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).
- Start with an empty list of used "tapes".
- As long as we get more WRITE commands:
- 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.
- Find a nice place for it on any of the used "tapes":
- Of all the "tapes" in our "used" list, select the one with the
smallest empty space that just fits the file.
- 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
- 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.
- Move/copy the backup data to its new position in the selected
- Report success and the label of the "tape" where the file was stored
back to Amanda.
- 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.
- If any directories have not been written to CDRW, and if CDR-media is
present in some drive, burn those directories to CDR.
- 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
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