Bacula-users

Re: [Bacula-users] question about how retention works

2013-12-20 13:02:56
Subject: Re: [Bacula-users] question about how retention works
From: Greg Woods <greg AT gregandeva DOT net>
To: Dan Langille <dan AT langille DOT org>
Date: Fri, 20 Dec 2013 11:00:33 -0700
Good, we're getting somewhere.

On Fri, 2013-12-20 at 11:45 -0500, Dan Langille wrote:

> Let's confirm this.  Let's look at this job:

{SQL stuff snipped}

That is what I was eventually going to get around to doing, so thanks
for doing that for me. So it looks like, if the same file is written to
Volumes in multiple jobs, then there are multiple File records for it.

> > Building directory tree for JobId(s)
> > 56,3603,3609,3616,3622,3710,3716,3722,3832,3839 ...
> > ++++++++++++++++++++++
> > 
> > For one or more of the JobIds selected, no files were found,
> > so file selection is not possible.
> 
> Ahh, look there: 'one or more'
> 
> Perhaps you are able to restore by regex because you're using the jobs 
> which are not passed the File retention period?

I'll have to check that, but I'm pretty sure I was able to restore the
entire /etc/.* tree, and the Full backup is definitely more than 30 days
old and got pruned. But I'll verify that.

But there is also the "bscan" command, the man page for which states:

       The  purpose  of bscan is to read (scan) a Bacula Volume and to
recreate or update the database contents
       with the information found on the Volume.  This is done in a
non-destructive way. This permits restoring
       database entries that have been lost by pruning, purging,
deleting, or a database corruption problem.

This implies that there is information on the Volumes that duplicates
what's in the database, but it doesn't say whether or not that includes
File records. So there is also the "bls" command, the man page for which
implies that it can list the files from a volume. So I tried it. It's
slow on my poor Raspberry Pi (the bacula-sd server), but it works:

bls: butil.c:287 Using device: "BKUP" for reading.
20-Dec 10:47 bls JobId 0: Ready to read from volume "BKUP.2" on device
"BKUP" (/bkup/bacula).
bls JobId 0: drwxrwxr-x   2 root     499             4096 2013-12-07
11:34:48  /var/lib/VirtualBox/
bls JobId 0: -rw-r--r--   1 989      986             3072 2013-12-08
00:32:01  /var/spool/asterisk/astdb.sqlite3
bls JobId 0: drwxr-x---   7 989      986             4096 2013-12-08
00:32:01  /var/spool/asterisk/
bls JobId 0: drwxrwx---   2 51       51              4096 2013-12-08
00:14:38  /var/spool/clientmqueue/
bls JobId 0: drwx--x---   3 root     lp              4096 2013-12-07
09:04:26  /var/spool/cups/
bls JobId 0: drwx------   2 root     man             4096 2013-12-08
00:14:39  /var/spool/mqueue/
bls JobId 0: -rw-------   1 root     root               9 2013-12-08
01:01:01  /var/spool/anacron/cron.weekly
bls JobId 0: -rw-------   1 root     root               9 2013-12-08
01:01:01  /var/spool/anacron/cron.monthly
bls JobId 0: -rw-------   1 root     root               9 2013-12-08
01:01:01  /var/spool/anacron/cron.daily
[....]

This does not contain information about which client those files came
from though. But that information would be available from Job records if
those are still present in the database.

So it would appear that, in fact, there is information on the Volumes
that duplicates the File records in the database, which means I may well
have been restoring files for which there were no longer any File
records in the database. I'll play some SQL games this weekend and see
if I can find an explicit example for which there is no File record but
I can still restore the file.

I hope some others out there have found this to be as informative as I
have.

--Greg


> 
> > Most likely your retention policy pruned the files.
> > 
> > Do you want to restore all the files? (yes|no): no
> > 
> > Regexp matching files to restore? (empty to abort):
> > 
> > At this point, I can type in a regex. Then it shows the usual 
> > parameters
> > followed by "yes/no/mod", which I can then modify in the usual way, and
> > then, although it takes quite a while, it will restore the files that
> > matched the regex.
> > 
> >> 
> >> Does what you've observed make sense when you consider my claim of
> >> 'first one counts'?
> > 
> > I'm not sure I can say it makes sense to me until I find some time to
> > poke around in the database to see what is really going on.
> > 
> > The one thing I am afraid of is having a Volume in the main pool 
> > getting
> > recycled causing the File records for files in the archive pool getting
> > pruned.
> 
> I think that is why I keep File and Job retention to 3 years.  To avoid 
> this situation.  I let Volume retention dictate how long I keep File and 
> Job records.  i.e. up to 3 years.
> 



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users