Bacula-users

Re: [Bacula-users] Question about recycle = no

2010-01-15 07:40:24
Subject: Re: [Bacula-users] Question about recycle = no
From: Jon Schewe <jpschewe AT mtu DOT net>
To: Phil Stracchino <alaric AT metrocast DOT net>
Date: Fri, 15 Jan 2010 06:35:15 -0600
On 01/14/2010 11:05 PM, Phil Stracchino wrote:
> Jon Schewe wrote:
>   
>> On 1/12/10 5:40 PM, Timo Neuvonen wrote:
>>     
>>>> So I'm backing data up to an external drive. I have maximum volume jobs
>>>> set to 1, to ensure that each job uses a different volume. I would also
>>>> like it such that volumes are not reused, so I assume I should set
>>>> recycle to no. Now the question is, when the retention period comes up,
>>>> will the volumes that are past the retention period be deleted? If they
>>>> are not, I'll run out of space on my external drive.
>>>>
>>>>     
>>>>         
>>> Bacula does not delete the volumes automatically. If recycling were 
>>> allowed, 
>>> the volumes would be re-used, but never actually deleted in that case 
>>> either.
>>>
>>> If you need to delete the volumes, you have to do it manually, or using 
>>> some 
>>> sort of admin job or script. And before deleting the volume files, also 
>>> delete the volumes from the catalog to prevent the catalog growing 
>>> unnecessarily.
>>>   
>>>       
>> Has anyone written such a script to handle this?
>>     
> I asked this same question recently.  There isn't a standard one.  I
> will be writing one shortly for my own needs.
>
>   
Turns out it was really easy, I wrote one last night. It's below. You
just want to change the find part of the script to find the appropriate
volumes, then run this as a before or after job script. You will want to
check this by working with a test pool, as I did, just to be sure it's
right.

#!/bin/bash

for file in `find /mnt/mybook/bacula -name 'Test-*'`; do
  volume=`basename ${file}`
  echo "*** Deleting Vol ${volume} from bacula catalog"
  /usr/sbin/bconsole <<EOF
delete volume="${volume}" yes
quit
EOF
  echo "*** Deleteing ${file} from disk"
  rm -f ${file}
done


-- 
Jon Schewe | http://mtu.net/~jpschewe
If you see an attachment named signature.asc, this is my digital
signature. See http://www.gnupg.org for more information.

For I am convinced that neither death nor life, neither angels nor
demons, neither the present nor the future, nor any powers,
neither height nor depth, nor anything else in all creation, will
be able to separate us from the love of God that is in Christ
Jesus our Lord. - Romans 8:38-39


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users