Bacula-users

Re: [Bacula-users] Restoring catalog backup from old volume

2012-09-13 12:30:35
Subject: Re: [Bacula-users] Restoring catalog backup from old volume
From: Win Htin <win.htin AT gmail DOT com>
To: Konstantin Khomoutov <flatworm AT users.sourceforge DOT net>
Date: Thu, 13 Sep 2012 12:28:14 -0400
On Thu, Sep 13, 2012 at 12:12 PM, Konstantin Khomoutov
<flatworm AT users.sourceforge DOT net> wrote:
> On Thu, 13 Sep 2012 10:39:39 -0400
> Win Htin <win.htin AT gmail DOT com> wrote:
>
>> Hi folks,
>>
>> I need to restore files from 4+ yrs back. I know the volume(s) where
>> the files are backed up but the backup records have been pruned. Since
>> I do have the db catalog backed up on a daily basis following is what
>> I am planning to do.
>>
>> 1. /etc/bacula/bin/bls -j -V <volume_name> <devicename>
>> 2. /etc/bacula/bin/bextract
>>
>> My question is, what parameters do I give to extract the db catalog
>> file? The Bacula utility document has examples for restoring files but
>> as far as I am aware of, not for extracting the db catalog back to a
>> directory you specify on the server.
>>
>> Following is an example of my catalog backup report:
>>
>> --------------------- start ---------------------------------------
>> 12-Sep 09:48 baculaserver-dir JobId 44234: BeforeJob: run command
>> "/etc/bacula/config/make_catalog_backup
>>  bacula bacula BACULA localhost"
> [...]
>
> You seems to be unaware of how catalog backup works in your Bacula
> install.  "The truth" here is that Bacula does not have any special
> means to back up its catalog--the script listed in your backup job
> output supposedly just calls something like `mysqldump` to dump the
> specified database to a file (supposedly placed somewhere
> under /var/lib/bacula and named something like "bacula.sql").
> That file then gets backed in a way no different from all those other
> files backed up on the same host.  A matching post-job script then
> deletes the file containing the database dump.
> Note that this file is only backed up if the rules in the FileSet
> resource used by the backup job matche that file.
>
> So you have to go this route:
> 1) Read the /etc/bacula/config/make_catalog_backup script and deduce
>    how the file it creates is named.
> 2) Then use bls on the relevant volumes and save its output to a file.
> 3) Inspect the generated listing looking for files matching the name
>    you deduced on step (1).
> 4) If you're lucky and your search turns out to be successful,
>    copy and paste the name of the relevant file exactly as it is
>    listed to another file, say, "/tmp/include".  Notice the name of the
>    volume which contains the relevant file.
> 5) Run bextract on the volume defined on step (4) and pass it the
>    include file using the "-i" command line argument.
>    After bextract finishes, you'll get your catalog dump file on disk.
> 6) Use a tool appropriate for your database engine to restore the
>    catalog (for MySQL that would supposedly be
>    `mysql -u bacula -p bacula </path/to/the/dump.sql`).
>
>    Be sure to first back up the existing catalog!
>
> Having said that, I should note two things.
>
> First, if you need to just restore several files, it mighe be more
> sensible to not bother with catalog at all: just run bls on the
> relevant volume(s), find the needed files, construct the include file
> and run bextract to extract those files.  If your files have well-known
> names, then just use bextract directly.
>
> Second, there is a pitfall related to excavation of *expired* jobs:
> after certain operations, Bacula performs a run over the catalog trying
> to scavenge expired job records etc, and this process will happily
> delete the records you restored.  To combat this, you have to
> temporatily adjust your expiration policy for that client -- it must be
> set to a longer period than the age of the oldest job you intend to
> restore.  After you have restored what's needed, revert the expiration
> period back.

Thanks, I'll try it out and post the results. Also, can I provide a
wildcard * in the include file since I need to restore multiple
sub-directories under the /share/backup/ directory?

Win

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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>