=head1	NAME

tape - Backup tape (backup media) management

=head1	SYNOPSIS

  tape -sn I<tapeset-file>
  tape -sc I<tapeset-file>
  tape -tn I<tape-file>
  tape -tc I<tape-file>

=head1	DESCRIPTION

The tape program can be used to manage backup media.
It implements the 10 tape rotation scheme using each tape
20 times in a 200-day (200-backups) period.

A collection of files and directories backed up to a set
of 10 tapes is referred to as a ``tape set''.

The tape program can

=over	4

=item	* ask for the next tape set to back up

=item	* confirm the last tape set was backed up properly

=item	* aks for the next tape within a set

=item	* confirm the last tape was written properly.

=back


=head1	OPTIONS

=over	4

=item	B<-sn> I<tapeset-file>

asks for the name of the current tape set.

=item	B<-sc> I<tapeset-file>

confirms that the current tape set was backed up properly
and allows to proceed to the next tape set.

=item	B<-tn> I<tape-file>

asks for the number of the current tape in the tape set.

=item	B<-tc> I<tape-file>

confirms that the current tape was written properly
and allows to use another tape if this tape set is backed
up the next time.

=back

=head1	RETURN VALUE

The program returns exit code 0 on success, a positive value on errors.

=head1	EXAMPLES

Imagine a university faculty, we have three backup sets:

  A ... configuration files in the /etc/directory...
  B ... faculty staff home directories
  C ... students home directories

The configuration files do not change oftenly, we back them up once
a week. The other days we want to back up home directories.

So the tape set file ``tape-sets'' looks like

  B C B C A

At each backup we ask for the set name first by running (in a Bourne-shell
or derivative):

  tapeset=`tape -sn tape-sets`

Now we can ask for a tape number

  tapeno=`tape -tn tapes.$tapeset`
  echo Please insert tape $tapeset $tapeno

Now we can use tar or cpio to write data to the tape (or whatever
backup media you prefer).
If this succeeded we confirm the tape first, the tape set next

  tape -tc tapes.$tapeset
  tape -sc tape-sets


=head1	NOTES

This is a very minimalistic backup only. I strongly recommend
to transfer the ``tape-sets'' file and ``tapes.A''... to
another computer after doing a successfull backup. Rsync
or scp/sftp can do this.

Doing all these operations manually is boring. Think about automating
backup using scripts.

I suggest cronjobs at night sending output to an administrator
by e-mail.

=head1	ADVANTAGES

Using the tape program and tar/cpio you have full control over your
backup.

Status and date information lives an a small couple of text files
which can be transferred easily to another computer.

In desaster recovery you only need a text editor or a program like
cat to search for the most recent tape for a tape set. No database,
no GUI required.

=head1	DISADVANTAGES

This backup media management requires you to do a _full_ backup
on each tape. In the conclusion a backup set size can not exceed
the tape capacity. Of course, full backups need more tapes
when differential or incremental backups.

Things are not ``ready-to-use''. It is up to you to layout file
systems, assign backup sets to tape sets, decide about
the backup set order, organize cronjobs, send output to syslog
or e-mail...

=head1	SEE ALSO

http://dktools.sourceforge.net/tape.html

=head1	AUTHOR

Dirk Krause

=head1	COPYRIGHT AND LICENSE

Copyright (c) 2001-2008, Dirk Krause
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above
   copyright notice, this list of conditions and the
   following disclaimer.

 * Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the following
   disclaimer in the documentation and/or other materials
   provided with the distribution.

 * Neither the name of the Dirk Krause nor the names of
   contributors may be used to endorse or promote products
   derived from this software without specific prior written
   permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

=head1	LAST MODIFICATION

2005/03/22

