Bacula-users

Re: [Bacula-users] Deleting files/folders on restores

2010-04-01 09:05:23
Subject: Re: [Bacula-users] Deleting files/folders on restores
From: Matija Nalis <mnalis+bacula AT CARNet DOT hr>
To: Marco Zimmermann <mzimmermann AT habegger DOT ch>, "bacula-users AT lists.sourceforge DOT net" <bacula-users AT lists.sourceforge DOT net>
Date: Thu, 1 Apr 2010 14:24:10 +0200
On Thu, Apr 01, 2010 at 01:48:34PM +0200, Marco Zimmermann wrote:
> Thanks for your reply!
> 
> >> How can I change this behavior? I mean restore in a way that newer
> >> files/folders will be deleted?
> > 
> > You need to backup with "Accurate = Yes", see
> > http://www.bacula.org/en/dev-manual/New_Features.html#SECTION00310000000000000
> > 000
> 
> We already using "Accurate = Yes" for all our Backups. So that's obviously
> not the reason why the file and folder isn't deleted.

Oh, I see. So the problem you have is happening only when you restore
to the same client and the same place you did a backup from ?

For example, if you restore to different directory (and/or to a
different client), do you then only get the wanted files ? 

If it is *not* so, then I guess something is broken with accurate
mode (and/or not *all* of your backups related to restore set have
been *created* with accurate=yes)

However, if restore to different (empty) directory gives you result
you want, then I think that is by intention and not a bug.

For example, maybe someone don't need to restore all the files, or
wants to select a regexp to rename files when restoring etc, or (s)he
simply wants to restore files removed by accident and not nuke all
the new files created in the meantime, and many other situations like
those. In those circumstances, "removing all files not in selected
restore fileset" would be wrong (and irrepairable). And as Bacula
(not any other system) cannot guess what you want, it goes by the
principle of least damage (not destroying stuff implicitely because
you might have wanted that).

So, back to your problem, if you don't want *ANYTHING* to remain in
the destination directory (the one selected in restore) *BUT* the
stuff you had on backup, you need to clean destination directory
yourself, for example by doing "rm -rf /dest/dir" before doing the
restore (or using more sophisticated techniques, of course).

I'm not sure if you can script that automatically in ClientRunBeforeJob 
(that is, if the script "sees" the restore variables like destination
directory etc). It would be nice if one could; however if you can't
you'll need to take care of it yourself (by scripting whatever does
the restore, to first nuke the whole directory)


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

<Prev in Thread] Current Thread [Next in Thread>