Amanda-Users

Re: DAMN! AN AMRECOVER DELETED ALL MY /ROOT CONTENTS!!!

2003-09-23 08:26:52
Subject: Re: DAMN! AN AMRECOVER DELETED ALL MY /ROOT CONTENTS!!!
From: Paul Bijnens <paul.bijnens AT xplanation DOT com>
To: Bruno Negrão <bnegrao-amanda AT engepel.com DOT br>
Date: Tue, 23 Sep 2003 14:19:32 +0200
Bruno Negrão wrote:
> [ lost a lot of files because amrecover removed them ]

Because I was 98% sure I did restores into a directory without
amrecover erasing files, I tried a test.  And indeed, when
being careful, amanda/tar does not existing files/directories.

I came to the conclusion that it is indeed because the
directory "." was added to the extraction list.  Adding "." means
restore this directory as it was, overwriting existing files,
and removing newer files.

However, the dangerous thing it seems is that "add *" also adds
files beginning with a dot, and the directory "." itself too.
If I remove dir "." from the extraction list, no files in that
directory were deleted.

Conclusion: maybe "add *" should not add "." by default.
What about dot-files?  What about "add .*"?
Proposal: "." should never be added except when mentioned
explicitly.

Adding warnings to amrecover is fine, as long as you don't
create a habit of ignoring it by asking too many times:
C:> del file.txt
Are you sure? y/n


Below is my test.  I added my comments with lines beginning
with '##'.


# cd /space/tmp/recovertst
# ls -l
drwxr-xr-x   2 paul     staff        512 Sep 23 13:41 dir1
drwxr-xr-x   2 paul     staff        512 Sep 23 13:41 dir2
drwxr-xr-x   2 paul     staff        512 Sep 23 13:41 dir3
-rw-r--r--   1 paul     staff        704 Sep 23 13:41 file1
-rw-r--r--   1 paul     staff         13 Sep 23 13:41 file2
-rw-r--r--   1 paul     staff          0 Sep 23 13:41 file3
# amrecover
AMRECOVER Version 2.4.4p1. Contacting server on amandahost ...
220 rivaner AMANDA index server (2.4.4p1) ready.
200 Access OK
Setting restore date to today (2003-09-23)
200 Working date set to 2003-09-23.
200 Config set to daily.
200 Dump host set to sunny.
Trying disk /space ...
$CWD '/space/tmp/restoretst' is on disk '/space' mounted at '/space'.
200 Disk set to /space.
Invalid directory - /space/tmp/restoretst
## Warning number one; not reliable because if the directory
## you are in, is a DLE, there is no warning.
amrecover> sethost metalix
amrecover> setdisk /
amrecover> setdate 2003-08-27
amrecover> ls
2003-08-27 .
2003-08-27 .Xauthority
2003-08-27 .bash_history
...
amrecover> add *
Added dir / at date 2003-08-27
Added /.Xauthority
Added /.bash_history
...
## here we see that . (translated as / is in the list!!!)
amrecover> delete .
Deleted dir / at date 2003-08-27
amrecover> list
...  ## just verifying and / is indeed gone.
amrecover> extract

Extracting files using tape drive /dev/nst0 on host amandahost.
The following tapes are needed: DAILY-12

Restoring files into directory /space/tmp/restoretst
Continue [?/Y/n]? y
## Here is the warning, maybe add here that if not empty
## files could be removed + overwritten.

Extracting files using tape drive /dev/nst0 on host amandahost.
Load tape DAILY-12 now
Continue [?/Y/n/s/t]? y
...
### restoring files here...
amrecover> exit
200 Good bye.
# ls -l
...
drwxrwxr-x   5 root     sys          512 Apr 19  1999 devices
drwxr-xr-x   2 paul     staff        512 Sep 23 13:41 dir1
drwxr-xr-x   2 paul     staff        512 Sep 23 13:41 dir2
drwxr-xr-x   2 paul     staff        512 Sep 23 13:41 dir3
drwxr-xr-x  28 root     sys         3072 Sep 23 13:47 etc
drwxrwxr-x   2 root     sys          512 Apr 19  1999 export
-rw-r--r--   1 paul     staff        704 Sep 23 13:41 file1
-rw-r--r--   1 paul     staff         13 Sep 23 13:41 file2
-rw-r--r--   1 paul     staff          0 Sep 23 13:41 file3
dr-xr-xr-x   2 root     root         512 Jan 28  2003 home
drwxr-xr-x   9 root     sys          512 Sep 23 13:45 kernel
...


--
Paul Bijnens, Xplanation                            Tel  +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM    Fax  +32 16 397.512
http://www.xplanation.com/          email:  Paul.Bijnens AT xplanation DOT com
***********************************************************************
* I think I've got the hang of it now:  exit, ^D, ^C, ^\, ^Z, ^Q, F6, *
* quit,  ZZ, :q, :q!,  M-Z, ^X^C,  logoff, logout, close, bye,  /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt,  abort,  hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e,  kill -1 $$,  shutdown, *
* kill -9 1,  Alt-F4,  Ctrl-Alt-Del,  AltGr-NumLock,  Stop-A,  ...    *
* ...  "Are you sure?"  ...   YES   ...   Phew ...   I'm out          *
***********************************************************************