Message: 4
Date: Wed, 04 Aug 2010 10:37:21 -0400
From: Josh Fisher <jfis...@pvct.com>
Subject: Re: [Bacula-users] bacula confused about slots on autochanger
To: bacula-users@lists.sourceforge.net
Message-ID: <4c597b21.2050...@pvct.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed


On 8/3/2010 9:20 PM, Maria McKinley wrote:
 > > It seems that part of the problem I have been having with backup is 
that
 > > bacula is having communication problems with the autochanger. Bacula
 > > tells the autochanger to load slot 3, but instead slot 2 is loaded:
On some systems, (BSD?) slot numbers are expected to begin at zero.
Bacula (and Linux) expect slot numbers to begin at one. When Bacula
sends a command to the autochanger to load slot 1, it is expecting the
first slot to be loaded. But on systems that number from zero, when you
use mtx to load slot 1 it will actually load the second slot. This can
be worked around by changing your autochanger script to subtract 1 from
the slot number on a load command and add 1 to slot numbers for the
loaded and list commands.

I am running linux, but this sounds like it would fix the problem. It 
isn't clear to me what to change. Here is the relevant bit from my 
script (3 is the input argument for slots). I don't think I can just 
change the setup argument to slot=$3+1, but not entirely sure why not:

# Setup arguments
ctl=$1
cmd="$2"
slot=$3
device=$4
drive=$5

debug "Parms: $ctl $cmd $slot $device $drive"

case $cmd in
    unload)
       debug "Doing mtx -f $ctl unload $slot $drive"
#
# enable the following line if you need to eject the cartridge
#     mt -f $device offline
#     sleep 10
       ${MTX} -f $ctl unload $slot $drive
       ;;

    load)
       debug "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)
       debug "Doing mtx -f $ctl -- to list volumes"
       make_temp_file
# Enable the following if you are using barcodes and need an inventory
#     ${MTX} -f $ctl inventory
       ${MTX} -f $ctl status >${TMPFILE}
       rtn=$?
       cat ${TMPFILE} | grep " Storage Element [0-9]*:.*Full" | awk 
"{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
#
# If you have a VXA PacketLoader and the above does not work, try
#  turning it off and enabling the following line.
#     cat ${TMPFILE} | grep " *Storage Element [0-9]*:.*Full" | sed "s/ 
Storage Element //" | sed "s/Full :VolumeTag=//"
#
       cat ${TMPFILE} | grep "^Data Transfer Element [0-9]*:Full 
(Storage Element [0-9]" | awk '{printf "%s:%s\n",$7,$10}'
       rm -f ${TMPFILE} >/dev/null 2>&1
       exit $rtn
       ;;

    loaded)
       debug "Doing mtx -f $ctl $drive -- to find what is loaded"
       make_temp_file
       ${MTX} -f $ctl status >${TMPFILE}
       rtn=$?
       cat ${TMPFILE} | grep "^Data Transfer Element $drive:Full" | awk 
"{print \$7}"
       cat ${TMPFILE} | grep "^Data Transfer Element $drive:Empty" | awk 
"{print 0}"
       rm -f ${TMPFILE} >/dev/null 2>&1
       exit $rtn
       ;;

    slots)
       debug "Doing mtx -f $ctl -- to get count of slots"
       ${MTX} -f $ctl status | grep " *Storage Changer" | awk "{print \$5}"
       ;;
esac

thanks,
maria

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to