[Box Backup] Restoring old directory tree?

Chris Wilson boxbackup@fluffy.co.uk
Mon, 7 Apr 2008 21:53:02 +0100 (BST)


Hi Pete,

On Mon, 7 Apr 2008, Peter Jalajas, GigaLock Backup Services wrote:

> I have a client that accidentally deleted a directory tree on Windows 
> last Friday.  Since then, newer versions of files have been created in 
> that deleted directory tree and backed up to the store.  The client 
> wants to restore the versions of the files that were in the deleted 
> directory tree at the time of deletion of the directory tree.
> 
> We've run
> bbackupquery "restore -d -i 00004c0c restored" quit
> and that seemed to restore scores of files.  The client is reviewing
> them now to see what they all had in common, to see if they meet his
> needs.
> 
> Can someone explain what restoring a deleted directory tree does with 
> respect to old, deleted and current files in that directory tree?  I'm 
> so fuzzy about how directories (old or deleted or even current) work in 
> Box Backup, that I'm not even sure I'm asking the question properly.

I'm not 100% sure either, but I just read the restore code and here is my 
understanding:

When bbackupd detects that a directory no longer exists, it will recurse 
down the directories on the server marking them and their contents as 
deleted. The latest version of each file that exists at that time is 
marked as deleted, rather than old. (I assume that bbackupd completed a 
sync before the deleted directory was recreated, otherwise the directory 
would not be marked as deleted on the store).

Time passes. Housekeeping on the server may remove files which are marked 
as old and deleted if needed to keep the account below its soft limit. 

bbackupd detects that a directory has been created. It doesn't care that 
an old, deleted directory with the same name exists on the store. It 
uploads the directory and its contents without the deleted flag. The newly 
uploaded directory has a new object ID and its contents are kept separate 
from the old, deleted directory.

The administrator runs the bbackupquery "restore" command with the -d flag 
and specifies the object ID of the deleted directory with the -i flag. 
bbackupquery reads that directory, and recurses down it, looking for files 
and directories which are flagged as "deleted" and not "old" (and by 
definition which have not already been removed by housekeeping) and 
restores those files.

My understanding is that you will get a complete restore unless/except:

The directory was recreated with new files before a bbackupd sync ran (or 
possibly during the sync). In this case, the top-level directory will not 
be marked as deleted, and if some of the files that it contained were 
replaced by files with the same name, then the versions that were deleted 
will now be marked as "old" instead of "deleted" (because bbackupd never 
had a chance to see that they were missing) and will be excluded from 
"restore -d", although the files may still on the store (unless removed by 
housekeeping) and can still be restored manually.

Housekeeping has purged some of the deleted files. In this case I'm afraid 
you will not be able to restore them and you will not know that it has 
happened except that files are missing from the restore.

If neither of these things has happened then I believe that you will be 
able to restore the directory as it was at the last sync before it was 
deleted, by doing as you have done, "restore -d" on the deleted directory 
ID.

Cheers, Chris.
-- 
_____ __     _
\  __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Ruby/Perl/SQL Developer |
\ _/_/_/_//_/___/ | We are GNU : free your mind & your software |