Bacula-users

Re: [Bacula-users] Deleting full and all subsequent incremental backups

2008-05-25 16:55:28
Subject: Re: [Bacula-users] Deleting full and all subsequent incremental backups
From: Arno Lehmann <al AT its-lehmann DOT de>
To: baculausers <bacula-users AT lists.sourceforge DOT net>
Date: Sun, 25 May 2008 22:55:04 +0200
Hi,

25.05.2008 19:37, Hemant Shah wrote:
> 
> 
> 
> --- On Sun, 5/25/08, Arno Lehmann <al AT its-lehmann DOT de> wrote:
> 
>> From: Arno Lehmann <al AT its-lehmann DOT de>
>> Subject: Re: [Bacula-users] Deleting full and all subsequent incremental 
>> backups
>> To: "baculausers" <bacula-users AT lists.sourceforge DOT net>
>> Date: Sunday, May 25, 2008, 3:58 AM
>> Hi,
>>
>> 25.05.2008 06:07, Hemant Shah wrote:
>>> Folks,
>>>
>>>   Is there a simple way/query in bacula to
>> prune/delete a full backup and it's subsequent
>> incremental backups?
>>> Here is what I am trying to do:
>>>
>>> I backup data to tape and disk.
>>>
>>> Run full backup to tape and then again to the disk on
>> 1st friday of the month, run incremental backup on other
>> days. I only want to keep previous one month's backups
>> on disk. 
>>> Example:
>>>   Backup first month to the disk
>>>   Backup second month to the disk
>>>   Before backing up third month delete all backups of
>> the first month.
>>>   I have set retention period on the disk pools to 2
>> months, but that will not remove all the backup jobs for
>> the first month at same time.
>>
>> True. However, I think retention times and automatic
>> pruning are the 
>> way to go.
>>
>> For disk setups, just create two pools - one for full, one
>> for 
>> incremental backups.
> 
>   Yes, I have one pool for full backups and one pool for incremental backups.
> 
>> Use "Maximum volume jobs", "Volume use
>> duration" or any othe other 
>> limiting directives to ensure only one run of backups goes
>> to each volume.
>>
>> Set the retention times to a bit below 2 months - 58 days
>> or something.
>>
>> Limit the number of volumes per pool, or pre-create the
>> necessary volumes.
>>
> 
> 
>   I have set UseVolumeOnce to yes, so each client has its own volume. The 
> volume name also contains timestamp.
> 
> 
>  
>> Then, Bacula will automatically recycle the volumes. It
>> will not 
>> automatically prune or even truncate the incremental
>> volumes depending 
>> on the pruned full volumes, but it will recycle them when
>> it needs them.
> 
>   I do not want to recycle the volumes. I want to delete the files as the 
> volume name contains timestamp.

Well, you already know the script from C M Reinehr, so I think you've 
got everything you need. Now I don't understand what's missing - I 
suppose selecting which volumes to remove is the question.

If it is, I would query the catalog directly (or use bconsole), list 
all the jobs per client, select everything that's older than the 
latest two full backups, purge these jobs, and finally delete all 
volumes that are older than two backup cycles and don't have any jobs 
left.

Sounds like a bit of work, but with some experimenting that should be 
possible. Direct SQL might be easier than using bconsole, but in case 
of a buggy script you'll end up in trouble... so I believe using 
bconsole might be more robust, but will require many more program 
calls, piping and parsing the output. A perfect job for perl, IMO :-)

Arno

> 
>> Arno
>>
>>> Hemant Shah
>>> E-mail: hjrrs AT yahoo DOT com
>>>
>>>
>>>       
>>>
>>>
>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>>
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> Bacula-users mailing list
>>> Bacula-users AT lists.sourceforge DOT net
>>>
>> https://lists.sourceforge.net/lists/listinfo/bacula-users
>> -- 
>> Arno Lehmann
>> IT-Service Lehmann
>> www.its-lehmann.de
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Bacula-users mailing list
>> Bacula-users AT lists.sourceforge DOT net
>> https://lists.sourceforge.net/lists/listinfo/bacula-users
> 
> 
> Hemant Shah
> E-mail: hjrrs AT yahoo DOT com
> 
> 
>       
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
> 

-- 
Arno Lehmann
IT-Service Lehmann
www.its-lehmann.de

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users