Bacula-users

Re: [Bacula-users] Bacula for disk drives Help

2010-04-06 23:31:25
Subject: Re: [Bacula-users] Bacula for disk drives Help
From: Phil Stracchino <alaric AT metrocast DOT net>
To: bacula-users AT lists.sourceforge DOT net
Date: Tue, 06 Apr 2010 23:28:29 -0400
On 04/06/10 22:26, ikkysleepy wrote:
> Hey, can you tell me if this is possible to  search for particular
> files in the backup?

Using what?  Do you mean select specific files for restore, or do you
mean you want to search backed-up data for a specific file without
knowing beforehand where it was backed up from?  Or something else again?

The first is, of course, built in.  The second would require a custom
SQL query (via the console sqlquery command) to locate the file so that
you could select it for restore.  Probably something somewhat like this
ought to do it, assuming you know the client it was backed up from:

SELECT j.Job, p.Path, n.Name FROM File AS f
LEFT JOIN Path AS p ON f.PathID = p.PathId
LEFT JOIN Filename AS n ON f.FilenameId = n.FilenameId
LEFT JOIN Job AS j  ON f.JobId = j.JobId
LEFT JOIN Client AS c ON j.ClientID = c.ClientId
WHERE c.Name = "your client here"
AND n.Name = "your filename here"
ORDER BY j.Job, p.Path;

here's an example, run directly against the Catalog because I didn't
feel like firing up a Bacula console just to make a SQL query  :)


mysql> SELECT p.Path, n.Name FROM File AS f LEFT JOIN Path AS p ON
f.PathID = p.PathId LEFT JOIN Filename AS n ON f.File.ClientID =
c.ClientId WHERE c.Name = "babylon5" AND n.Name = "gcc" ORDER BY c.Name,
j.Job, p.Path;
+---------------------------------------+------+
| Path                                  | Name |
+---------------------------------------+------+
| /usr/bin/                             | gcc  |
| /usr/i686-pc-linux-gnu/gcc-bin/4.3.4/ | gcc  |
| /usr/lib/distcc/bin/                  | gcc  |
| /usr/share/bash-completion/           | gcc  |
| /usr/lib/ccache/bin/                  | gcc  |
| /usr/bin/                             | gcc  |
| /usr/i686-pc-linux-gnu/gcc-bin/4.3.4/ | gcc  |
| /usr/lib/ccache/bin/                  | gcc  |
| /usr/lib/distcc/bin/                  | gcc  |
| /usr/share/bash-completion/           | gcc  |
| /usr/bin/                             | gcc  |
| /usr/i686-pc-linux-gnu/gcc-bin/4.3.4/ | gcc  |
| /usr/lib/ccache/bin/                  | gcc  |
| /usr/lib/distcc/bin/                  | gcc  |
| /usr/share/bash-completion/           | gcc  |
+---------------------------------------+------+
15 rows in set (4 min 12.65 sec)


I omitted job information from the output in this example because the
output would have been too wide and hard to read.  A query like this
will tell you all the locations on that client from where a file of that
specified name was backed up, and which job(s) each one was backed up in.



-- 
  Phil Stracchino, CDK#2     DoD#299792458     ICBM: 43.5607, -71.355
  alaric AT caerllewys DOT net   alaric AT metrocast DOT net   phil AT 
co.ordinate DOT org
         Renaissance Man, Unix ronin, Perl hacker, Free Stater
                 It's not the years, it's the mileage.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users