Hi,
        Solaris 9 (sun4u) bacula-2.0.2 (recently upgraded from 1.36.1)
[Mysql 4.0.21 Solaris 8,9,10, Linux 2.6 (FC5 & GENTOO), WIN-32 (WIN-XP) 
Clients.]

- Bacula built from source.
- Director & Storage Daemon on same machine.
- Storage device LTO STOREDGE-L8 Autochanger (Actually an HP autochanger).
------------------------------------------------------------
Having recently upgraded my site, bacula ran ok until the current volume in my 
autochanger filled up then
an automatic media change failed.

Initially, the mtx-changer script didn't work properly (apparently it was 
updated in the upgrade).
I found a solaris specific version in 
examples/autochangers/solaris-mtx-changers which I have attempted to use 
(having set the correct paths to mtx). [also having found that I actually had 
two version of mtx on my system one took a -d flag the other took a -f 
flag!!!!! - so I messed things up a bit there].

Now, when I run this script manually : e.g. 
./mtx-changer /dev/scsi/changer/c1t0d0 loaded 1 /dev/rmt/1mbn
It seems to work ok & returns the correct value saying e.g. slot 6 is loaded.

However in bconsole.
* status storage
Gives:
Device status:
Device "STOREDGE-L8" (/dev/rmt/1mbn) is mounted with Volume="backup029" 
Pool="*unknown*"
    Drive 0 status unknown.
    Total Bytes Read=0 Blocks Read=0 Bytes/block=0
    Positioned at File=0 Block=0

I have only ever used the default pool. - I don't recall getting "*unknown*" 
before!.

However:
* update slots scan 
Gives:
The defined Storage resources are:
     1: File
     2: HP-DDS3 4mm DAT Loader
     3: STOREDGE-L8
Select Storage resource (1-3): 3
Connecting to Storage daemon STOREDGE-L8 at aaaaaaaaaa:9103 ...
3995 Device "STOREDGE-L8" (/dev/rmt/1mbn) is not an autochanger.
Enter autochanger drive[0]:

Bacula no longer thinks my autochanger is really an autochanger!!

Obviously something has changed that I am not aware of.

Relevent bits from my config files......

bacula-dir.conf:
_________________

....
....
# Definition of SUN StorEdge-L8 (Ultrium)
Storage
    {
    Name = STOREDGE-L8
    Autochanger = yes
    Address = aaaaaaaaaa         # N.B. May need to use a fully qualified name 
here
    SDPort = 9103
    Password = bbbbbb
    Device = STOREDGE-L8
    MediaType = LTO
    Maximum Concurrent Jobs = 2  # enable status requests whilst writing
    }
.....
.....

bacula-sd.conf
______________

....
....
Device
    {
    Name = STOREDGE-L8
#    Tape Drive : HP Ultrium 1-SCSI
#    Changer ADIC FastStor 2
    Archive Device = /dev/rmt/1mbn
    Device Type = Tape
    Media Type = "LTO"                  # Linear Tape Open
    Autochanger = Yes
    Changer Device = /dev/scsi/changer/c1t0d0
    Changer Command = "/etc/bacula/mtx-changer %c %o %S %a %d"
    Drive Index = 0                     # Added this (to try to get 2.0.2 
working)
    LabelMedia = no;
    AutomaticMount = yes;
    RemovableMedia = yes
    AlwaysOpen = Yes;
    Hardware End of Medium = Yes;
    Fast Forward Space File = No
    Hardware end of file = no;
#    Not sure what this is supposed to do
#   MountAnonymousVolumes = no;
    Maximum Spool Size = 5g
    Spool Directory = /archive/spooling
    }
....
....

I attach my mtx-changer script(slightly fixed paths) which should not be 
causing a problem.. but since its in the "critical Path" here it is!.

Any help/suggestions gratefully received.

Many Thanks

Andrew R Paterson
DS Ltd.
Cedar Office Park
Cobham Road
Ferndown
Dorset BH21 7SB
 
Tel: +44 (0) 1202 877188
Fax: +44 (0) 1202 871297
www.ds.co.uk
#!/bin/bash -x
#
# /bin/sh isn't always compatible so use /bin/bash
#
# Bacula interface to mtx autoloader
#
#  $Id: solaris-mtx-changer,v 1.2 2006/02/22 18:43:55 kerns Exp $
#
#  If you set in your Device resource
#
#  Changer Command = "path-to-this-script/mtx-changer  %c %o %S %a %d"
#    you will have the following input to this script:
#
#  mtx-changer "changer-device" "command" "slot" "archive-device" "drive-index"
#                  $1              $2       $3        $4               $5
#
#  for example:
#
#  mtx-changer /dev/sg0 load 1 /dev/nst0 0 (on a Linux system)
#
#  If you need to an offline, refer to the drive as $4
#    e.g.   mt -f $4 offline
#
#  Many changers need an offline after the unload. Also many
#   changers need a sleep 60 after the mtx load.
#
#  N.B. If you change the script, take care to return either 
#   the mtx exit code or a 0. If the script exits with a non-zero
#   exit code, Bacula will assume the request failed.
#

# Sun sed/awk etc are not sufficient, working versions are in /usr/xpg4/bin
export PATH="/usr/local/bin:/usr/sfw/bin:/usr/xpg4/bin:/usr/bin"

MTX=/opt/gnu/bin/mtx


#
# The purpose of this function to wait a maximum 
#   time for the drive. It will
#   return as soon as the drive is ready, or after
#   waiting a maximum of 180 seconds.
# Note, this is very system dependent, so if you are
#   not running on Linux, you will probably need to
#   re-write it.
#
# If you have a FreeBSD system, you might want to change
#  the $(seq 180) to $(jot 180) -- tip from Brian McDonald
#
wait_for_drive() {
  for i in $(seq 180); do   # Wait max 180 seconds
    if ( mt -f $1 status | grep 0x0 ) >/dev/null 2>&1; then
      #echo "Device $1 READY"
      break
    fi
    #echo "Device $1 - not ready, retry ${i}..."
    sleep 1
  done
}


if test $# -lt 2 ; then
  echo "usage: mtx-changer ctl-device command slot archive-device drive"
  echo "  Insufficient number of arguments arguments given."
  echo "  Mimimum usage is first two arguments ..."
  exit 1
fi

# Setup arguments
ctl=$1
cmd="$2"
slot=$3
device=$4
# If drive not given, default to 0
if test $# = 5 ; then
  drive=$5
else
  drive=0
fi

#
# Check for special cases where only 2 arguments are needed, 
#  all others are a minimum of 3
case $cmd in
   loaded)
     ;;
   unload)
     ;;
   list)
     ;;
   slots)
     ;;
   *)
     if test $# -lt 3; then
        echo "usage: mtx-changer ctl-device command slot archive-device drive"
        echo "  Insufficient number of arguments arguments given."
        echo "  Mimimum usage is first three arguments ..."
        exit 1
     fi
     ;;
esac


case $cmd in 
   unload)
#     echo "Doing mtx -f $ctl unload $slot $drive"
#
# enable the following line if you need to eject the cartridge
      #mt -f $device offline
      mt -f $device rewoffl
      if test x$slot = x; then
         ${MTX} -f $ctl unload
      else
         ${MTX} -f $ctl unload $slot $drive
      fi
      ;;

   load)
#     echo "Doing mtx -f $ctl load $slot $drive"
      ${MTX} -f $ctl load $slot $drive
      rtn=$?
#
# Increase the sleep time if you have a slow device
# or remove the sleep and add the following:
      #sleep 15
      wait_for_drive $device
      exit $rtn
      ;;

   list) 
#     echo "Requested list"
      # Some tape changers lose track of their inventory (well, mine does) so 
      # do one before trying to get a status out of it.
      ${MTX} -f $ctl inventory
      ${MTX} -f $ctl status | grep " *Storage Element [0-9]*:.*Full" | awk 
"{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
# Comment out the previous line and add a line here
# to print "fake" barcodes.
#
# If you have a VXA PacketLoader and the above does not work, try
#  turning it off and enabling the following line.
#     ${MTX} -f $ctl status | grep " *Storage Element [0-9]*:.*Full" | sed 
"s/*Storage Element //" | sed "s/Full :VolumeTag=//"
      ;;

   loaded)
      ${MTX} -f $ctl status >/tmp/mtx.$$
      rtn=$?
      cat /tmp/mtx.$$ | grep "^Data Transfer Element $drive:Full" | awk "{print 
\$7}"
      cat /tmp/mtx.$$ | grep "^Data Transfer Element $drive:Empty" | awk 
"{print 0}"
      rm -f /tmp/mtx.$$
      exit $rtn
      ;;

   slots)
#     echo "Request slots"
      ${MTX} -f $ctl status | grep " *Storage Changer" | awk "{print \$5}"
      ;;
esac
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to