Filippo Zanardo's Blog

to blog or not to blog

Bacula Tape Restore Without Database

leave a comment »

Hi guys,
sometimes happens that your machine crash and is unrecoverable, so your bacula database, and so how can you extract what do you need from a tape used with bacula?

bacula volume utility tools come in help.
First you can try to check what jobs,files contain the tape with the command bls, for example:

bls -j -V Test1 /dev/st0

This command try to read the tape inside st0 with the volume Test1 (label of your tape) and show a list of job inside the tape, like:


bls: butil.c:258 Using device: "DDS-4" for reading.
11-Jul 11:54 bls: Ready to read from volume "Test1" on device "DDS-4" (/dev/nst0).
Volume Record: File:blk=0:1 SessId=4 SessTime=1121074625 JobId=0 DataLen=165
Begin Job Session Record: File:blk=0:2 SessId=4 SessTime=1121074625 JobId=1 Level=F Type=B
Begin Job Session Record: File:blk=0:3 SessId=5 SessTime=1121074625 JobId=5 Level=F Type=B
Begin Job Session Record: File:blk=0:6 SessId=3 SessTime=1121074625 JobId=2 Level=F Type=B
Begin Job Session Record: File:blk=0:13 SessId=2 SessTime=1121074625 JobId=4 Level=F Type=B
End Job Session Record: File:blk=0:99 SessId=3 SessTime=1121074625 JobId=2 Level=F Type=B
Files=168 Bytes=1,732,978 Errors=0 Status=T
End Job Session Record: File:blk=0:101 SessId=2 SessTime=1121074625 JobId=4 Level=F Type=B

This information is very important later for restore exactly what we need, SessId and SessTime is our precious information.

Now that we collect enough information we can proceed to restore with the useful command bextract, but we need to tell what session or job to extract, how?
Simple, with bootstrap file, based on the example above we need to restore session 3 from the tape so we create a simple file for example named sess3.bsr, with something similar inside:

Volume = Test1
VolSessionId = 3
VolSessionTime = 1121074625

Finally we can extract safely our data with bextract with this command:

bextract -b sess3.bsr /dev/st0 /tmp

and voilà you have restored exactly what you need with only a tape.

cheers!

Advertisements

Written by pipposan

June 9, 2010 at 10:14

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: