So, Bacula won't change from the first drive to the second, when the
first volume gets full??
This is correct bacula does not support that feature yet.
John
> *Ok guys, me and my team just developed this solution, for anyone who
has more than one drive in the server. It checks if the tape is full,
every quarter of hour, and switch from one drive to the next* (in that
case, using 03 DLT drives in the same CPU):
> /etc/crontab
00,15,30,45 * * * * root /etc/bacula/scripts/atualiza_drive.sh
> /etc/bacula/scripts/atualiza_drive.sh (it checks if the tape is full,
and run a second script - which will change drives)
#!/bin/bash
exec 6>&1
exec > /etc/bacula/status_script.log
/etc/bacula/bconsole -c /etc/bacula/bconsole.conf <<END
status storage="Multitape"
END
exec 1>&6 6>&-
grep -q "Device is BLOCKED waiting for media" /etc/bacula/status_script.log
if [ $? -eq "0" ]
then
/etc/bacula/scripts/drive_changer.sh
fi
> /etc/bacula/scripts/drive_changer.sh (it changes the drives)
#!/bin/bash
grep -q "Slot 1" /etc/bacula/status_script.log
if [ $? -eq "0" ]
then
/etc/bacula/scripts/drive12.sh
fi
grep -q "Slot 2" /etc/bacula/status_script.log
if [ $? -eq "0" ]
then
/etc/bacula/scripts/drive23.sh
fi
grep -q "Slot 3" /etc/bacula/status_script.log
if [ $? -eq "0" ]
then
/etc/bacula/scripts/drive31.sh
fi
> /etc/bacula/scripts/drive12.sh (example of drive* - autochanger commands)
/etc/bacula/scripts/multitape-changer /dev/sg0 unload 1 /dev/tape 0
/etc/bacula/scripts/multitape-changer /dev/sg0 load 2 /dev/tape 0
/etc/bacula/scripts/montar_volume.sh
> /etc/bacula/scripts/multitape_changer.sh
#!/bin/bash
#
# Bacula interface to use multiple drives as one tape-changer
# Mario Wolff - 28.01.05
#
# Arguments are copied from the mtx-script! Simply exchange
# the scriptname from demo-config
#
# If you set in your Device resource
#
# Changer Command = "path-to-this-script/multitape-changer" %c %o %S %a %d
# you will have the following input to this script:
#
# multitape-changer "changer-device" "command" "slot" "archive-device"
"drive-index"
# $1 $2 $3
$4 $5
#
# for example:
#
# multitape-changer /dev/sg0 load 1 /dev/nst0 0 (on a Linux system)
#
# Setup arguments
cmd="$2"
slot=$3
DEVICE=${4:-/dev/tape}
LABELDIR=/etc/bacula/tapelabel # where to find labelfiles
NULLDEVICE=/dev/null # if unmount link to this
SLOT01=/dev/nst0 # first slot
SLOT02=/dev/nst1 # second slot
SLOT03=/dev/nst2 # third slot
# simply append more
#get device for a given slotnumber
getdevice(){
myslot=${1:-1}
if [ ${#myslot} -gt 2 ];then exit 1;fi
if [ ${#myslot} -eq 2 ];then
eval echo \$SLOT$myslot
return
else
eval echo \$SLOT0$myslot
return
fi
}
#get name of labelfile for a given slot
getname(){
myslot=${1:-1}
if [ ${#myslot} -gt 2 ];then exit 2;fi
if [ ${#myslot} -eq 2 ];then
echo SLOT$myslot
return
else
echo SLOT0$myslot
return
fi
}
#how many tapes/slots to manage
getslots(){
count=1
while [ "$( getdevice $count )" ];do
count=$[ $count + 1 ]
done
echo $[ $count - 1 ]
return
}
#get slot for a given device-file
getslot(){
device=${1:-$NULLDEVICE}
if [ "$device" = "$NULLDEVICE" ];then
echo -en "0\n"
return
else
count=1
slotdev=$( getdevice $count )
while [ "$slotdev" ]; do
if [ "$slotdev" = "$device" ];then
echo -en "$count\n"
return
fi
count=$[ $count + 1 ]
slotdev=$( getdevice $count )
done
exit 3
fi
}
if test $# -lt 2 ; then
echo "usage: multitape-changer ctl-device command slot archive-device
drive"
echo " Insufficient number of arguments arguments given."
echo " Mimimum usage is first two arguments ..."
exit 4
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: multitape-changer ctl-device command slot
archive-device drive"
echo " Insufficient number of arguments arguments given."
echo " Mimimum usage is first three arguments ..."
exit 5
fi
;;
esac
case $cmd in
unload)
if [ -e $DEVICE ];then
rm $DEVICE && ln -s $NULLDEVICE $DEVICE || exit 6
else
ln -s $NULLDEVICE $DEVICE || exit 7
fi
;;
load)
CURDEV=$( getdevice $slot )
if [ -e $DEVICE ];then
rm $DEVICE && ln -s $CURDEV $DEVICE || exit 8
else
ln -s $CURDEV $DEVICE || exit 9
fi
;;
list)
slots=$( getslots )
for slot in $( seq 1 $slots );do
labelfile=$LABELDIR/$( getname $slot )
if [ -f "$labelfile" ];then
echo "$slot:$( head -n 1 $labelfile)"
else
echo "$slot:"
fi
done
exit 0
;;
loaded)
if [ -e $DEVICE ];then
line=$( ls -la $DEVICE )
fi
line=${line:-$NULLDEVICE}
getslot ${line##* }
sleep 1
exit 0
;;
slots)
getslots
exit 0
;;
esac
John Drescher wrote:
> On 12/6/06, *Heitor Medrado de Faria* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> So, Bacula won't change from the first drive to the second, when the
> first volume gets full??
>
>
> This is correct bacula does not support that feature yet.
> John
"Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), empresa
pública federal regida pelo disposto na Lei Federal nº 5.615, é enviada
exclusivamente a seu destinatário e pode conter informações confidenciais,
protegidas por sigilo profissional. Sua utilização desautorizada é ilegal e
sujeita o infrator às penas da lei. Se você a recebeu indevidamente, queira,
por gentileza, reenviá-la ao emitente, esclarecendo o equívoco."
"This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) -- a
government company established under Brazilian law (5.615/70) -- is directed
exclusively to its addressee and may contain confidential data, protected under
professional secrecy rules. Its unauthorized use is illegal and may subject the
transgressor to the law's penalties. If you're not the addressee, please send
it back, elucidating the failure."
-------------------------------------------------------------------------
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