RAIT (Redundant Array of Inexpensive Tape) Support

Author: Marc Mengel<mengel@fnal.gov>.  

Currently it is only integrated with the chg-manual changer script; 
collaboration on integrating it with the other tape changers is needed. 

What is a RAIT?

RAIT is an acronym for Redundant Array of Inexpensive Tapes, where
data is striped over several tape drives, with one drive writing 
an exclusive-or-sum of the others which can be used for error
recovery.  Any one of the data streams can be lost, and the data
can still be recovered.  

This means that a 3-drive RAIT set will
write 2 "data" streams and one "parity" stream, and give you
twice the capacity, twice the throughput, and the square of the 
failure rate (i.e. a 1/100 failure rate becomes 1/10,000, since
a double-tape failure is required to lose data).

Similarly, a 5-drive RAIT set will give you 4 times the capacity,
4 times the throughput (with sufficient bus bandwidth), and 
the square of the failure rate.

This means you can back up partitions as large as four times your tape 
size with amanda, with higher reliability and speed.

Using a RAIT:

If you have several tape devices on your system you tell amanda to use 
them as a RAIT by listing them as a single tape device using /bin/csh 
curly-brace-and-comma notation, as in:
	+------------------------------------
	| tapedev = "rait:/dev/rmt/tps0d{4,5,6}n"
	+------------------------------------
which means that /dev/rmt/tps0d4n, /dev/rmt/tps0d5n, and /dev/rmt/tps0d6n
are to be treated as a RAIT set.  You can now mount three tapes, and
label them with amlabel, etc.


Also, you want to create a new tape-type entry, which lists an n-drive
RAIT set, for this RAIT-set.  So if you were using an entry like:
	+------------------------------------
	| define tapetype EXB-8500 {
	|     comment "Exabyte EXB-8500 drive on decent machine"
	|     length 4200 mbytes
	|     filemark 48 kbytes
	|     speed 474 kbytes
	| }
	+------------------------------------
You would want to make a new one like:
	+------------------------------------
	| define tapetype EXB-8500x3 {
	|     comment "Exabyte EXB-8500 3 drive stripe on decent machine"
	|     length 8400 mbytes
	|     filemark 200 kbytes
	|     speed 948 kbytes
	| }
	+------------------------------------
and change your tapetype entry to:
	+------------------------------------
	| tapetype EXB-8500x3
	+------------------------------------
To tell amanda about the multiple drive set.

To use other than 3 or 5 tape RAIT sets, you need to change the blocksize
in the tapetype to be divisble by the number of data stripes in your
RAIT set (i.e. the number of devices minus one).

Blocksizes and Performance:

For better performance, and to get more flexibility with tape stripes,
you want to build amanda with a very large maxtapeblocksize, something
like:
    ./configure --with-maxtapeblocksize=640
Then you can do something like:
	+------------------------------------
	| tapedev = "rait:/dev/rmt/tps0d{4,5,6,7}n"
	...
	| tapetype DLT7000x4
	...
	| define tapetype DLT700x4 {
	|     comment "Exabyte DLT 4 drive stripe on decent machine"
	|     length 115167 mbytes
	|     filemark 120 kbytes
	|     speed 4482 kbytes
	|     blocksize 384 kbytes
	| }
	+------------------------------------
which will give you 128k physical blocks on the tape; more generally for
an n-tape stripe, you want (n-1)*32 kbytes for a tape that likes
32k physical blocks, or (n-1)*128 kbytes for a tape that likes
bigger blocks.

Hardware Compression:
the last stripe is the xor stripe, it is likely to compress poorly
relative to the other data stripes if you use hardware compression.

Disaster Recovery:

To assist in disaster recovery (as well as changer scripts) the 
amanda package now also includes "amdd", which is a simple dd(1)
replacement which supports (only) the "if=xxx", "of=xxx", "bs=nnn[kMb]"
"skip=nnn" and "count=nnn" options, but which can read and write RAIT 
tapesets.

Using amdd and your usual amanda unpack instructions will suffice
for disaster recovery from RAIT tape-sets.
