Bacula-users

Re: [Bacula-users] Delete old fileset resource

2017-04-06 23:59:16
Subject: Re: [Bacula-users] Delete old fileset resource
From: Bill Arlofski <waa-bacula AT revpol DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Thu, 6 Apr 2017 21:58:04 -0600
On 04/06/2017 10:36 AM, Reinier Carmona Lizana wrote:
> Hi all.
>
> I recently did a restructuring in the definitions of the FileSets,
> changing some settings, erasing some FileSets and creating new ones.
>
> By doing some recovery tests I noticed that Bacula gives me the option
> to recover a client with the previously used FileSet. That is,
> a historical list appears with all FileSets used by the client. I am still
> using thist filesets but that change for a list of my servers.
>
> Is there any way to upgrade it to erase that definition (which is no
> longer in the bacula-dir.conf) so that recovery is done with the current
> FileSet in order to avoid confusion?  The volume are in a LTO3-Ultrium tape.
>
>
> Thanks in advance.


Hello Reinier,

Bacula was designed to make it difficult to lose backup data. As such, some 
things cannot be easily deleted from the DB just by deleting the resource 
definition in the configuration files.

Clients are one example, Filesets are another.

The reason being that if you need to ever restore data from a job that was run 
against a particular client that has been decommissioned, Bacula needs to know 
some things, including the client, maybe the fileset, etc.  And, just 
recreating a client with the same name will not do the trick as it will be 
recognized as a new Client with a new id - so some db queries would need to be 
done to trick Bacula into thinking this new client is the original one.

In your case, since you know you do not need/want this fileset and do not plan 
on restoring files that were backed up using it, you might be able to simply 
remove it from the DB.

A couple things to consider before following my db query below:

- It might be best do delete any jobs from the catalog that used this fileset 
on this particular client:

In bconsole, do:

* sql
Entering SQL query mode.
Terminate each query with a semicolon.
Terminate query mode with a blank line .
Enter SQL query: select * from fileset;       <-- To see all Filesets

** Note the "filesetId" of the offending FileSet (if any exist that have not 
yet been purged)

- Make sure no other jobs/clients used this fileset. e.g. The default "Full
   Linux" fileset that is included in Bacula can be used against any number of
   Linux systems. In bconsole, do:

* sql
Entering SQL query mode.
Terminate each query with a semicolon.
Terminate query mode with a blank line .
Enter SQL query: select jobid,job,name,filesetid FROM job WHERE filesetid='X';

If there are no results, OR, if the results show that you do not care about 
the data from the returned list of jobs, you can just delete the jobs. Again 
in bconsole:

* delete jobid=xxxx   (for each job)


Then, when there are no jobs in the DB that have used this Fileset, it is time 
to finally delete it. Again, in bconsole, do:

* sql
Entering SQL query mode.
Terminate each query with a semicolon.
Terminate query mode with a blank line .
Enter SQL query: DELETE from fileset WHERE fileset='NameOfYourRetiredFileset';


Hope this helps,

Bill

-- 
Bill Arlofski
http://www.revpol.com/bacula
-- Not responsible for anything below this line --

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
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>