Restore behavior for 'current_mirror.*.snapshot ?'

Jason Piterak Jason_Piterak@c-i-s.com
Thu, 18 Apr 2002 17:33:05 -0400


Hi Ben (et al),
  Just got a chance to look at the changes in 0.7.2 with include and exclude
commands... Very cool.
  
  Mailing about a different issue... 
  What is/should be the behavior of rdiff-backup when you want to do a
restore of the current version of an archive?... I'm currently writing some
quick and dirty shell scripts using rdiff-backup for local and remote
backups, and I recently ran into a situation where a script wanted to
restore the current iteration of a backup. 
  Doing:
  rdiff-backup -v 6
$sourcePath/current_mirror.2002-04-18T11:21:13-04:00.snapshot
root@remoteServer::$restorePath
  ...fails (full output below)

  Instead of creating a directory $restorePath, rdiff-backup creates a
_file_, and then of course fails to be able to write the restored data into
that file.
  The was the case with 0.6.0 and also with a (patched) 0.7.2 [thanks
Daniel!]. This behavior is the same restore locally or remotely.

  Now, technically, I should be able to just copy the content of the archive
directory (sans 'rdiff-backup-data') to the destination directory... But
it'd be nice to keep things simple and use rdiff-backup (and my current
scripts) to do the restore ;-)...

  Hope all is well...

  Take care,
  --Jason


--------------------------------------------------------------------
[root@rembackup scripts]# rdiff-backup -V
rdiff-backup 0.7.2

[root@cenbackup1 scripts]# rdiff-backup -V
rdiff-backup 0.7.2


[root@cenbackup1 scripts]# rdiff-backup -v 6 --test-server
../remoteBackups/rembackup.cis.com/rdiff-backup-data/current_mirror.2002-04-
18T11\:21\:13-04\:00.snapshot
root@rembackup.cis.com::/home/backup/backupSystem/scripts/tmp/tmpRestore
Executing ssh root@rembackup.cis.com rdiff-backup --server
Testing server started by:  ssh root@rembackup.cis.com rdiff-backup --server
Server OK
Cleaning up
[root@cenbackup1 scripts]# rdiff-backup -v 6
../remoteBackups/rembackup.cis.com/rdiff-backup-data/current_mirror.2002-04-
18T11\:21\:13-04\:00.snapshot
root@rembackup.cis.com::/home/backup/backupSystem/scripts/tmp/tmpRestore
Executing ssh root@rembackup.cis.com rdiff-backup --server
Starting Restore
Using root mirror
/home/backup/backupSystem/scripts/../remoteBackups/rembackup.cis.com
Using mirror file
/home/backup/backupSystem/scripts/../remoteBackups/rembackup.cis.com
Restoring
/home/backup/backupSystem/scripts/../remoteBackups/rembackup.cis.com with
increments
../remoteBackups/rembackup.cis.com/rdiff-backup-data/current_mirror.2002-04-
18T11:21:13-04:00.snapshot to
/home/backup/backupSystem/scripts/tmp/tmpRestore
Applying increment
../remoteBackups/rembackup.cis.com/rdiff-backup-data/current_mirror.2002-04-
18T11:21:13-04:00.snapshot to
/home/backup/backupSystem/scripts/tmp/tmpRestore
Regular copying ('current_mirror.2002-04-18T11:21:13-04:00.snapshot',) to
/home/backup/backupSystem/scripts/tmp/tmpRestore
Restoring
/home/backup/backupSystem/scripts/../remoteBackups/rembackup.cis.com/home
with increments  to /home/backup/backupSystem/scripts/tmp/tmpRestore/home
Regular copying ('home',) to
/home/backup/backupSystem/scripts/tmp/tmpRestore/home
Making directory /home/backup/backupSystem/scripts/tmp/tmpRestore/home
Sending back exception:
  File "/usr/local/bin/rdiff-backup", line 1585, in answer_request
    try: result = apply(eval(request.function_string), argument_list)

Traceback (most recent call last):
  File "/usr/local/bin/rdiff-backup", line 5719, in ?
    Globals.Main.Main()
  File "/usr/local/bin/rdiff-backup", line 5465, in Main
    self.take_action(rps)
  File "/usr/local/bin/rdiff-backup", line 5445, in take_action
    elif self.action == "restore": apply(self.Restore, rps)
  File "/usr/local/bin/rdiff-backup", line 5595, in Restore
    HighLevel.Restore(rtime, mirror_base, mirror_rel_index, inc_tup, rpout)
  File "/usr/local/bin/rdiff-backup", line 4849, in Restore
    baseinc_tup, target_base)
  File "/usr/local/bin/rdiff-backup", line 4618, in RestoreRecursive
    inclist, target)
  File "/usr/local/bin/rdiff-backup", line 4532, in RestoreFile
    RPath.copy_with_attribs(rpbase, rptarget)
  File "/usr/local/bin/rdiff-backup", line 1884, in copy_with_attribs
    RPath.copy(rpin, rpout)
  File "/usr/local/bin/rdiff-backup", line 1799, in copy
    elif rpin.isdir(): rpout.mkdir()
  File "/usr/local/bin/rdiff-backup", line 2262, in mkdir
    self.conn.os.mkdir(self.path)
  File "/usr/local/bin/rdiff-backup", line 1677, in __call__
    return apply(self.connection.reval, (self.name,) + args)
  File "/usr/local/bin/rdiff-backup", line 1616, in reval
    if isinstance(result, Exception): raise result
OSError: [Errno 20] Not a directory:
'/home/backup/backupSystem/scripts/tmp/tmpRestore/home'
Traceback (most recent call last):
  File "/usr/local/bin/rdiff-backup", line 5719, in ?
    Globals.Main.Main()
  File "/usr/local/bin/rdiff-backup", line 5465, in Main
[root@cenbackup1 scripts]#     self.take_action(rps)
  File "/usr/local/bin/rdiff-backup", line 5443, in take_action
    PipeConnection(sys.stdin, sys.stdout).Server()
  File "/usr/local/bin/rdiff-backup", line 1601, in Server
    self.get_response(-1)
  File "/usr/local/bin/rdiff-backup", line 1568, in get_response
    try: req_num, object = self._get()
  File "/usr/local/bin/rdiff-backup", line 1482, in _get
    raise ConnectionReadError("Truncated header string (problem "
__main__.ConnectionReadError: Truncated header string (problem probably
originated remotely)

[root@rembackup scripts]# ls -al tmp/
total 8.0k
drwxr-xr-x    2 root     root         4.0k Apr 18 16:42 ./
drwxr-xr-x    5 root     root         4.0k Apr 18 16:14 ../
-rw-------    1 root     root            0 Apr 18 16:42 tmpRestore
[root@rembackup scripts]#


---------------------------------------
[root@cenbackup1 scripts]# rm -f tmp/tempRestore
[root@cenbackup1 scripts]# rdiff-backup -v 6
../remoteBackups/rembackup.cis.com/rdiff-backup-data/current_mirror.2002-04-
18T11\:21\:13-04\:00.snapshot tmp/tempRestore
Starting Restore
Using root mirror
/home/backup/backupSystem/scripts/../remoteBackups/rembackup.cis.com
Using mirror file
/home/backup/backupSystem/scripts/../remoteBackups/rembackup.cis.com
Restoring
/home/backup/backupSystem/scripts/../remoteBackups/rembackup.cis.com with
increments
../remoteBackups/rembackup.cis.com/rdiff-backup-data/current_mirror.2002-04-
18T11:21:13-04:00.snapshot to tmp/tempRestore
Applying increment
../remoteBackups/rembackup.cis.com/rdiff-backup-data/current_mirror.2002-04-
18T11:21:13-04:00.snapshot to tmp/tempRestore
Regular copying ('current_mirror.2002-04-18T11:21:13-04:00.snapshot',) to
tmp/tempRestore
Restoring
/home/backup/backupSystem/scripts/../remoteBackups/rembackup.cis.com/home
with increments  to tmp/tempRestore/home
Regular copying ('home',) to tmp/tempRestore/home
Making directory tmp/tempRestore/home
Traceback (most recent call last):
  File "/usr/local/bin/rdiff-backup", line 5719, in ?
    Globals.Main.Main()
  File "/usr/local/bin/rdiff-backup", line 5465, in Main
    self.take_action(rps)
  File "/usr/local/bin/rdiff-backup", line 5445, in take_action
    elif self.action == "restore": apply(self.Restore, rps)
  File "/usr/local/bin/rdiff-backup", line 5595, in Restore
    HighLevel.Restore(rtime, mirror_base, mirror_rel_index, inc_tup, rpout)
  File "/usr/local/bin/rdiff-backup", line 4849, in Restore
    baseinc_tup, target_base)
  File "/usr/local/bin/rdiff-backup", line 4618, in RestoreRecursive
    inclist, target)
  File "/usr/local/bin/rdiff-backup", line 4532, in RestoreFile
    RPath.copy_with_attribs(rpbase, rptarget)
  File "/usr/local/bin/rdiff-backup", line 1884, in copy_with_attribs
    RPath.copy(rpin, rpout)
  File "/usr/local/bin/rdiff-backup", line 1799, in copy
    elif rpin.isdir(): rpout.mkdir()
  File "/usr/local/bin/rdiff-backup", line 2262, in mkdir
    self.conn.os.mkdir(self.path)
OSError: [Errno 20] Not a directory: 'tmp/tempRestore/home'
[root@cenbackup1 scripts]#

[root@cenbackup1 scripts]# ls -al tmp/
total 8.0k
drwxr-xr-x    2 backup   backup       4.0k Apr 18 17:00 ./
drwxr-xr-x    5 backup   backup       4.0k Apr 18 15:11 ../
-rw-------    1 root     root            0 Apr 18 17:00 tempRestore
[root@cenbackup1 scripts]#


---
Jason Piterak
System Analyst
CIS Technical Services
33 Main St., Suite 302
Nashua, NH 03064
(603) 889-4684 - FAX (603) 889-0534