*BSD News Article 78909


Return to BSD News archive

Newsgroups: comp.unix.bsd.bsdi.misc
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!cancer.vividnet.com!hunter.premier.net!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!newsfeed.internetmci.com!news.ingress.net!news.new-york.net!spcuna!spcvxb!terry
From: terry@spcvxb.spc.edu (Terry Kennedy, Operations Mgr.)
Subject: Re: autoloader tape backup software for BSDI
Nntp-Posting-Host: spcvxa.spc.edu
References: <526vrg$adk@mars.father.com>
Sender: news@spcuna.spc.edu (Network News)
Organization: St. Peter's College, US
Date: Mon, 23 Sep 1996 22:42:08 GMT
Message-ID: <1996Sep23.184208.1@spcvxb.spc.edu>
Lines: 69

In article <526vrg$adk@mars.father.com>, waldo@ writes:
> Does anyone know of ANY tape software that is capable of operating an auto-
> loader?  All I really want to do is automate the changing of tapes via a script
> so I can 'dump' one device per tape without having to baby-sit the tape drive.
> 
> Please forgive my obvious 'newbie-ness' as I'm sure the word 'scsicmd' is on
> some kind readers mind, but I have absolutely no clear idea on how to use
> scsicmd to address the drive, or if I should be addressing the loader.

  You don't say what sort of device you have - the Archive 4592's I have will
automatically cycle to the next tape when the first tape is unloaded. If you're
on BSD/OS 2.1, look in the Amanda contributed area for some autoloader support
(though I don't know if it works with BSD/OS or with your drive). If you need
complex operations (not just "load the next tape") that should be easier to
implement in a forthcoming release.

  Here's the script I use to cycle tapes:

#!/bin/sh
#
# Script to do backups of all file systems that need backing up
#
tape=/dev/rst0

echo ""
echo "This procedure will back up the disks to tape."
echo -n "Is this what you want to do? [yn] "

read ans
case $ans in
    [nN]*)  echo "Ok. We won't do backups."; exit 1;;
esac

tempfile=/tmp/bck$$

awk	'$1 !~ /^.dev/ { next }
	$2 ~ /tmp/ { next }
	$2 ~ /backroot/ { next }
	$2 ~ /backroot2/ { next }
	$2 ~ /spare/ { next }
	$2 ~ /sparesw/ { next }
	$2 ~ /news\/spool/ { next }
	$2 ~ /news\/novdata/ { next }
	$4 != "rw" { next }
	{ printf $1":"$2" " }' /etc/fstab >$tempfile

echo ""
echo "Backing up the following file systems:"
for filesys in `cat $tempfile`; do
    echo $filesys | sed -e 's;:\(.*\)$; (on \1);'
done


for filesys in `cat $tempfile`; do
    fstoback=`echo $filesys | sed -e 's;dev/;dev/r;' -e 's;:.*;;'`

    cmd="dump 0usf 1000000 $tape $fstoback"
    cmd2="mt -f $tape offline"

    `$cmd`
    `$cmd2`
    sleep 120
done    

rm $tempfile
echo ""
echo "Finished with backups."
exit 0