Bacula-users

Re: [Bacula-users] restoring directly from archived files (progress, but still questions)

2010-01-17 02:52:11
Subject: Re: [Bacula-users] restoring directly from archived files (progress, but still questions)
From: Ross Boylan <RossBoylan AT stanfordalumni DOT org>
To: John Drescher <drescherjm AT gmail DOT com>
Date: Sat, 16 Jan 2010 23:49:09 -0800
On Sat, 2010-01-16 at 16:10 -0800, Ross Boylan wrote:
> Answering myself, but please correct me if I'm wrong.
> 
> On Sat, 2010-01-16 at 15:32 -0800, Ross Boylan wrote:
> > 
> > (I got this error earlier too).  My retention policy likely has nuked
> > them in the main database.  Given that I have a backup of the
> > catalog*,
> > and the volumes with the files, what's my best move?
> 
> Restore the job that backed up the old catalog.
> Shut bacula down.
> Backup the database.
> Restore the old database from the file restored in the first step.
> Startup bacula.
> Restore files.
> Shut down bacula.
> Restore current state of db.
> Restart bacula.
I did this, following instructions in comments  of make_catalog_backup
(not sure if that's Debian specific) to restore.  Here's how the final
restore went:
<quote>
corn:/usr/local/var/lib/bacula# date; dropdb -U postgres bacula
Sat Jan 16 23:23:23 PST 2010
corn:/usr/local/var/lib/bacula# createdb -U postgres -E SQL-ASCII bacula
corn:/usr/local/var/lib/bacula# dirs
/usr/local/var/lib/bacula /var/lib/bacula /usr/local/src/tools
corn:/usr/local/var/lib/bacula# popd
/var/lib/bacula /usr/local/src/tools
corn:/var/lib/bacula# date; sudo -u bacula psql bacula < bacula.sql
</quote>

The restore of the old db was the same, except with a different bacula.sql.

Comments:

-E SQL-ASCII was critical.  Without it I defaulted to UTF8; the restore
with psql produced
<quote>
ALTER TABLE
ERROR:  invalid byte sequence for encoding "UTF8": 0xe56e2d
HINT:  This error can also happen if the byte sequence does not match the 
encoding expected by the server, which is controlled by "client_encoding".
CONTEXT:  COPY filename, line 10777
</quote>
Why UTF8 doesn't work when the entire system AFAIK is on UTF8 is a
mystery, but I've always found this to be the case, I think even with
empty db's.  Using PostgreSQL 8.3.

Before I set the right encoding, the import left the filename table
empty, which in turned produced "There were no files inserted into the
tree," errors in bconsole.

I thought those might be from my retention policy, so I loosened it way
up.  I don't know how critical that was.

I stopped and started the sd and the director.

Even with the correct encoding, the import of the bacula.sql via psql
opens with a boatload of warnings:
<quote>
SET
SET
SET
SET
SET
SET
ERROR:  index "pool_name_idx" does not exist
ERROR:  index "path_name_idx" does not exist
ERROR:  index "media_volumename_id" does not exist
ERROR:  index "log_name_idx" does not exist
ERROR:  index "job_name_idx" does not exist
ERROR:  index "job_media_job_id_media_id_idx" does not exist
ERROR:  index "fileset_name_idx" does not exist
ERROR:  index "filename_name_idx" does not exist
ERROR:  index "file_pathid_idx" does not exist
</quote>
and many more.  Are those normal and harmless?

Some of the specification of users was essential given the
permission/access setup on my system; I am not sure if the sudo was
necessary but it seemed safest.
> 
> 
> I guess I could also use bscan, but I recall that was pretty slow when I
> used it years ago.
> 
> It would be nice if there were a way to merge the old and the new db.
> 
> Will the retention policy immediately zap the catalog entries I restore?
Still wondering about this.
> 
> Ross
> 
> P.S. I burn my monthly full backups and leave mid-month things on disk.
> As luck would have it, I just deleted the intermediate Dec backups
> yesterday, and that's probably what I really need.
Fortunately, the restored data was sufficient to solve my problem.

Since I ended up copying all the volumes (though not the bsr files) to
their original home on disk, I'm still not sure how to restore direct
from DVD.  How to do that is my main outstanding question.

Thanks.
Ross

P.S. When I went into the restore dialog, entered a regexp, and then
selected
    5: Test filename manipulation
I was not able to exit the test without doing ctl-c twice to exit
bconsole.  I'm assuming that's a bug that has since been fixed.


------------------------------------------------------------------------------
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