Bacula-users

Re: [Bacula-users] vchanger and "intervention needed"

2013-10-31 15:56:00
Subject: Re: [Bacula-users] vchanger and "intervention needed"
From: Josh Fisher <jfisher AT pvct DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Thu, 31 Oct 2013 15:53:26 -0400
On 10/31/2013 1:18 PM, Dimitri Maziuk wrote:
> On 10/31/2013 11:55 AM, Josh Fisher wrote:
>> That fixes it for vchanger, but you still have to fix Bacula's 
>> catalog, which still has records for the volumes on changer1_0006. In 
>> bconsole, use 'delete volume=changer1_0006_0001' and etc. to delete 
>> the volumes that were on the broken disk. 
> By "delete and purge" I meant delete and purge buttons in bat. So bat 
> is well and truly b0rk3d, what else's new. Any way to specify 
> changer1_0006_* in bconsole? (Ranges and commas don't seem to work, I 
> tried.) I'm using 25GB volumes on 1TB drives that'll become 3 or 4TB 
> drives at some point. Deleting volumes one by one can get annoying.

I don't think so. Wildcards in 'delete volume' would be pretty 
dangerous. You can, though, run bconsole from a shell script. I use the 
following on Centos. You would invoke it as 'bdelmag changer1_006 1 50' 
if there were 50 volume slots, for example.

#!/bin/sh
#
###  bdelvol   Delete  volume records from Bacula catalog for a range
###            of a vchanger magazine's slots

#
# Prepend zeros to $1 and return a string that is $2 characters long
#
function mklen ()
{
    o1=$1
    while [ `expr length ${o1}` -lt "$2" ] ; do
       o1="0${o1}"
    done
    echo $o1
}

#
# Display usage error help
#
function disphelp ()
{
    echo "Usage:"
    echo "   bdelmag mag_name start_slot end_slot"
}

if [ "z$1" == "z" -o "z$2" == "z" -o "z$3" == "z" ] ; then
    disphelp
    exit 1
fi
if [ $3 -lt 1 ] ; then
    disphelp
    exit 1
fi
if [ $2 -gt $3 ] ; then
    disphelp
exit 1
fi

mag=$1
n=$2
maxvol=`expr $3 + 1`

# Invoke bconsole to delete specified volumes
while [ $n -lt $maxvol ] ; do
    s=`eval mklen $n 4`
    bconsole <<EOD
delete volume=${mag}_${s}
EOD
    n=`expr $n + 1`
done



------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>