How To:Stripe Dumps across Tapes using RAIT

From The Open Source Backup Wiki (Amanda, MySQL Backup, BackupPC)
Jump to navigationJump to search

This article is a part of the How Tos collection.

Overview

The basis of a RAIT configuration is the RAIT Device, which allows Amanda to mirror (with two child devices) or stripe with parity (with 3 or more child devices) data across several child devices. The RAIT device should not be confused with RAID -- a RAID system will continue functioning in a degraded state, while the RAIT device will not write in a degraded state. It does allow reading in a degraded state, in order to support recoveries.

You have a few options for implementing this solution, depending on the version of Amanda you have and your particular situation.

No Changer

The most basic RAIT configuration is similar to a basic tape configuration with no changer, but with two or more tape devices:

tapedev "rait:/dev/nst{0,1,2}"

In this configuration, you'll need to make sure the right tape is in the drive for each dump. Amanda will only write to one tape per dump run, as it has no way to request an additional tape.

chg-rait

For more complex configurations, chg-rait is appropriate. This changer is explicitly designed to operate several changers in parallel, and assemble their results into a RAIT device.

new chg-rait

The new chg-rait script, which will not be available until the release following 2.6.1, allows you to specify a combination of changers to run in parallel using notation similar to the RAIT device.

To begin, specify each of your robots in a separate changer section:

define changer "robot1" {
  tpchanger "chg-zd-mtx"
  changerdev "/dev/mtx1"
  changerfile "/etc/amanda/myconfig/chg-zd-mtx-1.conf"
}
define changer "robot2" {
  tpchanger "chg-zd-mtx"
  changerdev "/dev/mtx2"
  changerfile "/etc/amanda/myconfig/chg-zd-mtx-2.conf"
}
define changer "robot3" {
  tpchanger "chg-zd-mtx"
  changerdev "/dev/mtx3"
  changerfile "/etc/amanda/myconfig/chg-zd-mtx-3.conf"
}

Where the named changerfiles contain the usual sorts of chg-zd-mtx configuration.

Then specify a RAIT changer as the top-level tape changer:

tpchanger "chg-rait:robot{1,2,3}"

old chg-rait

This old changer script uses some trickery to operate independent "child changers" and distributes changer commands to its children. It is fairly buggy, and is not supported after Amanda-2.6.1.

The changer configuration file (chg-rait.conf in this case) begins with

  nchangers=2

which gives the number of child changers; then come a series of variables for each child changer, each with a numeric suffix:

  tpchanger_1="chg-zd-mtx"
  changerdev_1="/dev/mtx1"
  changerfile_1="/etc/amanda/myconfig/chg-zd-mtx.conf"
  tapedev_1="/dev/scsi/changer/c3t5d1"
  tpchanger_2="chg-disk"
  tapedev_2="file:/var/vtapes"

Amanda.conf then points to this file

 tpchanger "chg-rait"
 changerfile "chg-rait.conf"

Fully Worked Example

Disclaimer: Known to work on Solaris with Sony TSL-9000 autoloaders and amanda-2.6.0p2, YMMV.

This assumes that you have a working configuration named Dailyset1 and all the non-RAIT parameters have been set.

It is probably easiest to set up and test a non-RAIT configuration, and once that works, make the following modifications to convert to a RAIT setup after deleting all log files, everything under curinfo/ and emptying the tapelist and tapelist.amlabel files.


Set the following in amanda.conf:

 tpchanger "chg-rait"                                    # the tape-changer glue script (chg-rait modified,
   see below)
 tapedev "rait:tape:/dev/rmt/{0,1,2}ln"                      # the no-rewind tape devices
 changerfile "/usr/local/etc/amanda/Dailyset1/changer.conf"  # tape changer configuration parameter file
 #changerdev                                                 # tape changer configuration parameter device
   (not used here)

In changer.conf:

#
nchangers=3
#
tpchanger_1="chg-zd-mtx"                                    # modified chg-zd-mtx, see below
changerdev_1="/dev/scsi/changer/c3t4d1"                       # changer device
changerfile_1="/usr/local/etc/amanda/Dailyset1/changer1.conf" # device specific config file
#tapedev_1                                                    # not used
#
tpchanger_2="chg-zd-mtx"                                    # modified chg-zd-mtx, see below
changerdev_2="/dev/scsi/changer/c3t5d1"                       # changer device
changerfile_2="/usr/local/etc/amanda/Dailyset1/changer2.conf" # device specific config file
#tapedev_2                                                    # not used
#
tpchanger_3="chg-zd-mtx"                                    # modified chg-zd-mtx, see below
changerdev_3="/dev/scsi/changer/c3t6d1"                       # changer device
changerfile_3="/usr/local/etc/amanda/Dailyset1/changer3.conf" # device specific config file
#tapedev_3                                                    # not used

In the changerX.conf files (one file for 3 identical loaders should be OK, but not tested):

# Device specific parameters for the loaders. See the comments at the start of chg-zd-mtx for details
#
firstslot=1
lastslot=7 
havereader=0
autoclean=0
poll_drive_ready=5
initial_poll_delay=5
cleanslot=8
#

Note: chg-zd-mtx as supplied gets it's configuration from amanda.conf and is called by chg-rait 3 times, once for each loader. The clean fix would be to modify chg-zd-mtx to optionally accept explicit configuration information from the caller and modify chg-rait to provide it from the changer.conf file.

RAIT expects all 3 loaders to be in sync, that is all loaders are in the same state, have the same number of tapes, and all tapes have the same labels in corresponding slots.

Test your configuration.

Try amtape Dailyset1 reset and all the loaders should load slot 1 and amtape Dailyset1 current should show slot 1 as loaded.

You may get some warnings, but if all loaders load properly, ignore them.

With slot 1 loaded for all loaders, label the tapes.

amlabel -f Dailyset1 Dailyset1-001
amtape Dailyset1 slot next
amlabel -f Dailyset1 Dailyset1-002
amtape Dailyset1 slot next
.
.
.

And so on until all tapes are labeled.

Load slot 1 (amtape Dailyset1 slot 1) and do a test backup (amdump Dailyset1).