I put some time into this and I thought I would share. It took some script
hacking and I'll be the first to admit that it could use some tweaking but
here are the modifications for chg-zd-mtx, to work with mtx-1.2.10, solaris
8, and a L280 tape changer, amanda-2.4.2. I put some sleep commands around
the tape io, some are necessary, some not. also the I didn't feel like
geting a stopwatch but it works ok. Also I'll include my
/kernel/drv/sgen.conf and the relevent parts of my amanda.conf and my
chg-scsi.conf. Thanks to Eric Doutreleau, for a good script to start with.
If anyone wants to tackle it, the DD commands should have a semiphore lock
to prevent io errors, I plan to write this in later but if someone else
whats to that would be great too.
>From amanda.conf:
tapedev "/dev/rmt/0hn" # the no-rewind tape device to be used
tpchanger "chg-zd-mtx" # the tape changer script
changerdev "/dev/scsi/changer/c4t1d0"# Tape changer
changerfile "/usr/local/amanda/config/chg-scsi.conf"# Tape changer config
chg-scsi.conf:
number_configs 1
eject 0 # Tapedrives need an eject command
sleep 95 # Seconds to wait until the tape gets ready
cleanmax 20 # How many times could a cleaning tape get used
changerdev /dev/scsi/changer/c4t1d0
#
# Next comes the data for drive 0
#
config 0
drivenum 0
dev /dev/rmt/0hn # the device that is used for the tapedrive 0
startuse 1 # The slots associated with the drive 0
enduse 6 #
statfile /usr/local/amanda/etc/slot # The file where the actual slot is
stored
cleancart 7 # the slot where the cleaningcartridge for drive 0 is located
cleanfile /usr/local/amanda/etc/info/clean # The file where the cleanings
are recorded
usagecount /usr/local/amanda/etc/info/totaltime
relevent entries from sgen.conf:
device-type-config-list="changer"
name="sgen" class="scsi" target=0 lun=0;
name="sgen" class="scsi" target=1 lun=0;
name="sgen" class="scsi" target=2 lun=0;
name="sgen" class="scsi" target=3 lun=0;
name="sgen" class="scsi" target=4 lun=0;
name="sgen" class="scsi" target=5 lun=0;
name="sgen" class="scsi" target=6 lun=0;
name="sgen" class="scsi" target=7 lun=0;
name="sgen" class="scsi" target=8 lun=0;
name="sgen" class="scsi" target=9 lun=0;
name="sgen" class="scsi" target=10 lun=0;
name="sgen" class="scsi" target=11 lun=0;
name="sgen" class="scsi" target=12 lun=0;
name="sgen" class="scsi" target=13 lun=0;
name="sgen" class="scsi" target=14 lun=0;
name="sgen" class="scsi" target=15 lun=0;
diff -rc amanda/chg-zd-mtx /flatiron/scratch/amanda-2.4.2/changer-src/chg-zd-mtx >
amanda/chg-zd-mtx-L280.patch
*** amanda/chg-zd-mtx Mon Jan 8 20:39:37 2001
--- /flatiron/scratch/amanda-2.4.2/changer-src/chg-zd-mtx Sat Jan 6 13:26:54
2001
***************
*** 7,15 ****
#
# Contributed by Eric DOUTRELEAU <[EMAIL PROTECTED]>
# This is supposed to work with Zubkoff/Dandelion version of mtx
- #
- # Modified by Robert Weber <[EMAIL PROTECTED]
- # to work with an L280 under solaris 8
# try to hit all the possibilities here
prefix=/usr/local/amanda
--- 7,12 ----
***************
*** 43,54 ****
fake=0
MT=/usr/bin/mt
MTF=-f
! MTX="mtx -f "$TAPE
! DD="/usr/bin/dd bs=32k"
firstslot=1
lastslot=6
# counted from 1 !!!
! cleanslot=7
changerfile=`amgetconf$SUF changerfile`
--- 40,51 ----
fake=0
MT=/usr/bin/mt
MTF=-f
! MTX=mtx
! DD=/usr/bin/dd
firstslot=1
lastslot=6
# counted from 1 !!!
! cleanslot=-2
changerfile=`amgetconf$SUF changerfile`
***************
*** 63,75 ****
#
readstatus() {
! echo $MTX" status" >>$DBGFILE
! used=`$MTX status | grep "Data Transfer Element" | awk '{print $7}'
! echo sleep 15 >>$DBGFILE
! sleep 15
! # sed -n 's/Data Transfer Element:.Empty/-1/p;s/Data Transfer Element:.Full
(Storage Element \(.\) Loaded)/\1/p'`
! if [ "$used" -eq "" ]; then
used=`cat $slotfile`
fake=1
fi
--- 60,69 ----
#
readstatus() {
! used=`$MTX status |
! sed -n 's/Data Transfer Element:.Empty/-1/p;s/Data Transfer Element:.Full
(Storage Element \(.\) Loaded)/\1/p'`
! if [ "$used" -eq -1 ]; then
used=`cat $slotfile`
fake=1
fi
***************
*** 79,88 ****
eject() {
readstatus
if [ $used -gt 0 ];then
- echo $MTX" unload "$used >> $DBGFILE
$MTX unload $used 2>/dev/null
- echo sleep 44 >> $DBGFILE
- sleep 44
echo 0 $tape
exit 0
else
--- 73,79 ----
***************
*** 94,108 ****
reset() {
readstatus
if [ $used -gt 0 ];then
- echo $MTX" unload "$used >>$DBGFILE
$MTX unload $used 2>/dev/null
- echo sleep 43 >> $DBGFILE
- sleep 43
fi
- echo $MTX" load 1 ">> $DBGFILE
res=`$MTX load 1 2>&1`
- echo sleep 42 >> $DBGFILE
- sleep 42
if [ $? -eq 0 ];then
echo "1 $tape"
exit 0
--- 85,93 ----
***************
*** 120,129 ****
case $whichslot in
current)
if [ $used -lt 0 ];then
- echo $MTX" load 1">> $DBGFILE
$MTX load 1 2>/dev/null
- echo sleep 41 >> $DBGFILE
- sleep 41
echo "1 $tape"
exit 0
else
--- 105,111 ----
***************
*** 168,174 ****
else
expr $accesscount + 1 > $accessfile
if [ $accesscount -gt 9 ]; then
! $myname -slot clean >>$DBGFILE
fi
fi
--- 150,156 ----
else
expr $accesscount + 1 > $accessfile
if [ $accesscount -gt 9 ]; then
! $myname -slot clean >/dev/null
fi
fi
***************
*** 181,190 ****
if [ $fake -eq 0 ];then
echo " -> unload $used" >> $DBGFILE
- echo $MTX" unload "$used >> $DBGFILE
res=`$MTX unload $used 2>&1`
- echo sleep 40 >> $DBGFILE
- sleep 40
status=$?
echo " -> status $status" >> $DBGFILE
echo " -> res $res" >> $DBGFILE
--- 163,169 ----
***************
*** 198,222 ****
exit 0
fi
echo " -> load $load" >> $DBGFILE
- echo $MTX" load "$load >>$DBGFILE
res=`$MTX load $load 2>&1`
- echo sleep 46 >> $DBGFILE
- sleep 46
status=$?
echo " -> status $status" >> $DBGFILE
echo " -> res $res" >> $DBGFILE
if [ $status -eq 0 ];then
echo " -> rew $load" >> $DBGFILE
- echo $MT" "$MTF" "$tape" rewind" >> $DBGFILE
$MT $MTF $tape rewind
- echo sleep 15 >> $DBGFILE
- sleep 15
- echo $DD" if="$tape" count=1 ">> $DBGFILE
$DD if=$tape count=1 >> $DBGFILE 2>&1
echo "$load $tape"
echo "$load" > $slotfile
- echo sleep 10 >> $DBGFILE
- sleep 10
exit 0
else
res2=`echo $res | grep "Storage Element . is Empty"`
--- 177,192 ----