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 - Installation & Usage

1. Prerequisites

You need the following software installed on your system if you want to use the CDRW-Taper:

  • Perl. Any perl 5 installation should do, CDRW-Taper does not use any fancy perl features.
  • mkisofs and cdrecord from the cdrtools package. CDRW-Taper has been tested with mkisofs 1.12.1 and cdrecord 1.8.1.
  • If you want to write backups to DVD+R/+RW or DVD-R/-RW you also need the DVD+RW tools. DVD+RW support has been tested with cdrtools 2.0, dvd+rw-tools 5.21.4.10.8, a Ricoh MP5125A drive and a NEC ND-1300A drive.
  • sendmail or a compatible replacement. CDRW-Taper has been tested with the sendmail replacement that comes with qmail and the one that comes with postfix.

2. Download

You can download the current version of CDRW-Taper from here: http://www.tivano.de/software/amanda/cdrw-taper-0.4.tar.gz

3. Installation

  1. Install Amanda.
  2. Download the CDRW-Taper and unpack the archive in a temporary directory.
  3. Rename the original taper binary that comes with Amanda to e.g. taper.orig
  4. Edit the "taperlib.pm" and "amlabel-cdrw" scripts as described below to reflect your system environment.
  5. Move the taper perl script to the original location of the Amanda taper binary and put "taperlib.pm" in the same directory as "taper".
  6. Put the "amlabel-cdrw" perl script somewhere in your path.
  7. Change your Amanda config as described below.

4. Configuration

Most of the CDRW-Taper's configuration is done via the standard Amanda configuration file, but there are some settings such as the path of mkisofs that don't fit in there. These settings are currently hard-coded into the taperlib.pm script itself.

Since the PORT-WRITE command is now supported you no longer need to configure a holding disk. A holdingdisk may still be useful if you have to backup more than one machine or more than one physical disk (the "spindle" parameter in Amanda's "disklist"). Without a holding disk Amanda can't do multiple dumps in parallel.

You can set the writing speed of cdrecord via the environment variable CDR_SPEED. See the cdrecord manpage for details.

4.1 Hardcoded amlabel-cdrw settings:

Add the directory where "taperlib.pm" can be found to the perl include path:

push @INC, "/usr/lib/amanda";

(Obviously, you have to replace "/usr/lib/amanda" with the correct path on your system.)

4.2 Hardcoded taperlib.pm settings

$CONFIG_ROOT
The directory where your Amanda configurations are stored.
$DUMP_DIR
The directory where subdirectories for intermediate storage will be created.
$DELETE_DIRS
Set to 1 if intermediate directories should be deleted after burning them to disk.
$WRITE_NON_ERASABLE
Set to 1 if you want to allow burning directories on non-erasable CDR, DVD+R or DVD-R media.
$CD_DEVICE_RE
Regular expression to scan for a CDRW dump device. If the Amanda config file entry "rawtapedev" does not match this regular expression, the CDRW-Taper assumes that the device is not a CDRW drive and executes the original taper binary. If you are using a standard Linux distibution, you should not need to edit this.
$TAPER_ORIG
The full pathname of the original taper program.
$BLOCKSIZE
Block size of output media in bytes (2048 for CDRW).
$MEDIABLOCKS
Number of output blocks per media (332800 for a 650 MB CDRW, 2294921 for a 4700 * 10^6B DVD). As of version 0.4 the taper will try to determine the capacity of the media in the drive using the "cdrecord -atip" (and optionally "dvd+rw-mediainfo") tool. In that case, $MEDIABLOCKS will be used as a fallback value.
Please remember that you have to change the tapetype in "amanda.conf" if you modify this value! (The tapetype.length in "amanda.conf" tells amanda how many bytes to send to the taper. $MEDIABLOCKS tells the taper how many blocks to write on the given media. These values should be roughly the same.)

When running amlabel-cdrw, amdump, amflush or taper you must have "mount", "umount", "cdrecord", "mkisofs" and "sendmail" in your $PATH. If you're using DVD+RW or DVD-RW you must also have "dvd+rw-format", "dvd+rw-mediainfo" and "growisofs" in your $PATH. Usually these reside in "/bin", "/usr/bin" and "/usr/sbin".

4.3 Required amanda.conf settings

tapedev
The CDRW-Taper misuses this entry to specify the directory where the CDRW can be mounted. Make sure that there is a corresponding entry in /etc/fstab and that the CDRW can be mounted by the user running amdump, amflush and amlabel-cdrw.
rawtapedev
This entry is used to specify the real CDRW device. Actually two different device specifications are required here:
  • the "dev=" parameter passed to "cdrecord", and
  • a device name for mounting the device (an "/etc/fstab" entry must exist so that the Amanda user can mount the device on the directory given by the "tapedev" parameter, see above).
Therefore, "rawtapedev" looks like this: "<mount-device>:<cdrecord-device>" (where <cdrecord-device> may also contain a colon). The first part is used to mount the device using the command "$MOUNT -r <mount-device>". The second part is passed verbatim to cdrecord; see the dev= parameter in the cdrecord manpage for an explanation of legal values.
tapelist
The location of the "tapelist" file (containing a list of all known tapes)
tapecycle, labelstr, logdir, runtapes, tapetype
As per Amanda documentation.
tpchanger
"tpchanger" is optional, of course. The device names returned by the tapechanger commands must match the specification of "rawtapedev" above. Please note that tapechanger support in this version of CDRW-Taper is almost completely untested.

5. Manual operations

Sometimes during a backup the CDRW-Taper may fail to write an intermediate directory to disk (e. g. when you forget putting the correct media into the drive...). In that case, an email will be sent to the address(es) given in the "mailto" configuration parameter, listing all the disk labels that still need to be burned to disk. To do that the "taper" command can be run manually:

<path>/taper <config> -flush <label> [<label> ...]

This will flush all intermediate directories for the given labels to their media, provided the corresponding disks are available.

If you're using a "gravity" changer the media with the first listed label must be the "current" media in the changer. Also, the labels on the command line must be listed in the same order as the media in the changer. There must not be any empty slots or other unlisted media in between.

6. Backups to Directories

If you want to run backups into directories only, i. e. without using any CDR or CDRW media, you must use the following setup:

  • The important part is the $DUMP_DIR variable in taperlib.pm - it specifies the directory where the backups will be stored. Also, set $WRITE_NON_ERASABLE to 0.
  • In amanda.conf, set rawtapedev and tapedev to some directories that don't exist (note that the part of rawtapedev after the colon must match $CD_DEVICE_RE), like
    tapedev = "/doesnt_exist"
    rawtapedev = "/doesnt_exist:/dev/sg5000"
    
    With these settings $CDRECORD and $MKISOFS should never be executed. Some error messages will appear in the amanda report, like "could not mount CD-RW", which can safely be ignored.

    Alternatively, you can use real directory and device names and simply not insert any blank media when you run the backup. This way you can still write the backups to some media at a later time using the "taper ... -flush" command.
  • You have to create a "tapelist" file in the amanda configuration directory (or whereever the "tapelist" parameter in "amanda.conf" points to), or make sure that one exists and contains usable labels, like this:
    00000000 daily-34 reuse
    00000000 daily-33 reuse
    00000000 daily-32 reuse
    00000000 daily-31 reuse
    
    Amanda is quite picky about the format of these lines. Use exactly one space between the entries and make sure there are no trailing spaces or odd line endings (CR). The middle item must match the "labelstr" in amanda.conf. You must define at least as many labels as specified by the "tapecycle" parameter in amanda.conf.

7. Limitations & known problems

  • The error handling for the PORT-WRITE command is less than graceful. PORT-WRITE is alpha code, use carefully!
  • Due to a limitation in the taper protocol, the CD-RW cannot use Amanda's standard error reporting mechanism to errors that occur while burning the CD-RW. Instead, it mails an error report to all adresses specified in the Amanda config file entry "mailto".
  • The tape changer support is almost completely untested.
  • Error-handling is incomplete in some places.
  • The intermediate directories are named after the disk label only. This may lead to interference if you're using multiple Amanda configurations with identical disk labels. Be careful!
  • Some amanda commands like "amcheck" and "amrestore" don't work with this taper, simply because their tape-access routines are hardcoded (unlike "amdump" which executes an external "taper" command). This is not seen as a big problem, because amcheck will still check your client configuration, and you can restore from CDRW easily by accessing the files on the media directly.
  • Even if burning to disk fails (or isn't even tried) the "tapes" are marked as used in the "tapelist" file. That's not a bug, because the "tape" contents are still available in the intermediate directories.
  • CDRW-Taper can only use media labels that are either contained in the "tapelist" file or on media present in any writer devices. This is sufficient if you use media previously labelled with "amlabel-cdrw".
    If you want to make backups to CDR-media only or to hard disk only, you never use "amlabel-cdrw" and therefore CDRW-Taper will never find usable media.
    In these cases you have to manually edit the "tapelist" file and create entries like this:
    0 Label1 reuse
    0 Label2 reuse
    The labels must match the "labelstr" in your amanda.conf, and you must enter at least as many labels as your "tapecycle" parameter specifies. See the section "Backups to Directories" on this subject.

8. Acknowledgements & Thanks to

  • Tim Writer <tim@starnix.com>

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