head	1.1;
access;
symbols;
locks; strict;
comment	@# @;


1.1
date	97.07.29.17.25.42;	author rkirkpat;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@Rkirkpat's Backup Scripts -- Two backup scripts for backing up a
network of Linux/Unix boxes via a single Linux box with a SCSI tape
drive.

Copyright (c) 1997 by Ryan Kirkpatrick (rkirkpat@@nag.cs.colorado.edu). 
  All rights reserved.

* This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

* This program is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  General Public License for more details.

* You should have received a copy of the GNU General Public License
  along with this program; see the file COPYING.  If not, write to the
  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

There are two parts to these scripts.

* backup.full.script.sh -- This is the script for performing a full
  backup of all hosts to tape.

* backup.inc.script.sh -- This is the script for performing an
  incremental backup of all hosts to tape. The incremental backups are
  written to the same tape after the full backup. The definition of
  incremental is any files that have been modified in the last 24
  hours from the time the script is run.

How to install and use.

* Go to sunsite.unc.edu and download, compile, and install 'afio' for
  Linux if you do not already have it. It is a better version of cpio,
  and required to use these scripts.

* Copy the scripts to a directory that they are to be run from. I keep
  them in /root.

* Create the directory /root/backup_info/. In this directory create a
  file for each host to be backed up. The name of the file is the full
  hostname of that file, i.e., 'somehost.some.domain'. The contents of
  the file is a space delimited list of the directories to backup,
  i.e., '/usr /home /bin'. Be aware that that all directories below
  the given directory that are on the same file system will be backed
  up. So if you have / on one filesystem and /usr on another
  filesystem, place both into the file, to backup the entire system. A
  couple of examples are included in the backup_info directory.

* Create the directory /home/backup/catalogs/. This is where the
  catalog files will be written. This includes header files, file
  listings, the tape catalog, and the last used block on the
  tape. Don't store anything else in this directory, as the
  backup.full.script.sh script deletes everything in that directory
  each time it is run.

* Next of all create directories in /mnt for each of the systems to be
  backed up. The naming scheme to be used is the directory name should
  be the same as the hostname without domain, i.e., 'somehost'. Then
  mount the root filesystem of that remote machine at this mount
  point, with the options no_root_squash and rw. This filesystem only
  needs to be mounted during the backup process to rearrange files on
  the remote system to allow for an rsh backup.

* Set up cron jobs to run backup.full.script.sh once a week or so, and
  backup.inc.script.sh every other day. Here is the blurb from my
  crontab. Note that the scripts should be run as root.

  # Backups
  00 01 * * 0-2,4-6 root /root/backup.inc.script.sh
  00 01 * * 3 root /root/backup.full.script.sh

* Next create the file /root/.rhosts.backup on each machine to be
  backed up, with the hostname of the system with the tape drive as
  the only contents. Then create /root/.rhosts.backup on the machine
  with the tape drive with the hostname of all machines to be backed
  up, one per line.

* Lastly, only if you are running RedHat 4.0+ or are using pam
  security. Copy /etc/pam.conf to /etc/pam.conf.real and to
  /etc/pam.conf.backup. Then edit /etc/pam.conf.backup and comment
  out or delete the below line. This is to allow root to rsh in, but
  only when the backup scripts have copied /etc/pam.conf.backup to
  /etc/pam.conf. Do this on all machines to be backed up and the
  system with the tape drive.

  rsh    auth       required     /lib/security/pam_securetty.so

Notes

When it comes to backups, everyone needs a slightly different
solutions. This leaves you with two choice. Get a large, multi-purpose
program that does everything you need and most probably much more. Or
write shell scripts that are custom tailored to what you need. 

The former solution can often times be expensive, and in the spirit of
Linux, the latter solution is the one I choose. These scripts, while
not completely tailored for general use, should work rather well on
most Linux boxes, especially RedHat 4.0 boxes. This means that you
will have to do some testing and customizing of the
scripts. Especially if you want to change the directory structure
around. But there are many comments in the scripts. 

These scripts are custom written for my own setup and needs. I am
releasing them to the Linux community, for more than anything else, to
give people an idea and a starting point to write their own backup
scripts if they so choose. Not as a drop in backup program. If that is
what you are looking for, there are many other such program, free and
commercial out there.

The features of these scripts are that:
  * Completely written in bash for simplicity and ease of modification.
  * Uses only standard Unix commands, meaning it is possible to pull
    data back off of the tapes with just afio and mt, and not needing
    the backup scripts or any other extra programs. A definite plus
    when you are rebuilding boxes with only rescue floppy disks.
  * A network backup that requires only minimal modifications and
    installation on remote systems. That is also fast and once again
    uses standard utilities.
  * Control the tape at a block level, as all of the file level
    commands for tape control seemed quite unreliable and
    dangerous. With block level control, you know exactly where you
    are on the tape at all times.

One thing to be aware of is that these scripts are not terribly
secure. They are used on a LAN of five computers, where I am the only
user on all of the systems and no one else is. As well, I am the only
one with physical access to them. They are protected from
the Internet via a firewall. This means the inside net is relatively
insecure, and security is not a big issue on the inside. So, be
careful before using them on a network where security is more
important.

Also, to backup system you do not wish to have nfs or rsh on, take a
look at the backup.ftp.full.sh and backup.ftp.inc.sh scripts included
in the extras directory. These scripts use ncftp to upload an afio
stream to another server, usually the server with the tape drive, and
into a file. That way, when that machine is backed up the afio backup
file of the remote machine is also backed up. This is only really
useful for backing up system with small hard disks. I use it to backup
my firewall, about 40mb on average for a full backup and less than
500kb for a incremental backup.

If you have any questions or comments about these scripts, feel free
to email me at rkirkpat@@nag.cs.colorado.edu.

----------------------------------------------------------------------------
|   "For to me to live is Christ, and to die is gain."                     |
|                                            --- Philippians 1:21 (KJV)    |
----------------------------------------------------------------------------
|  Ryan Kirkpatrick  |  Boulder, Colorado  | rkirkpat@@nag.cs.colorado.edu  |
----------------------------------------------------------------------------
|               http://www-ugrad.cs.colorado.edu/~rkirkpat/                |
----------------------------------------------------------------------------

@
