Amanda-Users

Re: add option --occurrence to gnutar amrecover command [Was: Re: Problems accessing my new autoloader]

2007-11-27 09:07:54
Subject: Re: add option --occurrence to gnutar amrecover command [Was: Re: Problems accessing my new autoloader]
From: Jean-Louis Martineau <martineau AT zmanda DOT com>
To: Paul Bijnens <Paul.Bijnens AT xplanation DOT com>
Date: Tue, 27 Nov 2007 08:56:38 -0500
I tested it, and tar doesn't exit after the first occurrence. Maybe because it read from a pipe.

Anyway, amidxtaped will read the complete image from tape, decompress it, send it to amrecover. amrecover will fail because tar would have exited.

Jean-Louis

Paul Bijnens wrote:


On 2007-11-23 09:35, Francis Galiegue wrote:
Le Friday 23 November 2007 09:17:01 Marc Muehlfeld, vous avez écrit :
One additional info to my last mail (sorry. I just replied to the sender,
and not to the list, thats why I let it below):

5 Minutes after I send this mail, the silent amrecover finished it's work and the files where recovered. But why does it take 45 minutes to restore one 45kb file? On the tape were just 9.1 GB in 60 files, so it should be finished fast. Also its a fast LTO3 drive connected to a fast Adaptec 29160
SCSI card


Tar will unroll ALL the archive to find your file. Not sure why it doesn't stop if it finds the file at the beginning/middle of the archive though.


Because a file can appear multiple times in a tar archive, and
the normal semantics says that it needs the last version, unless
specified on the command line.

In gnutar you may store files multiple times in an archive. e.g.
 $ gtar -cf /tmpk/multi.tar file1 file1 file1
 $ gtar -tf /tmp/multi.tar
and note the file appears 3 times.
You can even append to an existing archive:
 $ date > file1
 $ gtar -rf /tmp/multi.tar file1
and when you restore, you get last version only.
Or be more specific about a specific occurrence:
 $ gtar --occurrence=3 -tvf /tmp/multi.tar

Amanda will *not* store multiple files in a tar archive, and
we could add indeed the option  "--occurrence" (the default=1)
for extracting with amrecover and then, according to the info page,
gnutar will terminate without scanning to the end of the archive.

This could speed up the restore process considerably for the "few files"
restores, the most frequent requests.

So the default restore command would become:
   gtar --occurrence --numeric-owner --xpGvf - extractlist


Patch against 2.5.2p1: file recover-src/extract_list.c:

--- extract_list.c_ORIG 2007-11-23 10:17:22.000000000 +0100
+++ extract_list.c      2007-11-23 10:18:36.000000000 +0100
@@ -1773,7 +1773,7 @@
 #endif
     case IS_TAR:
     case IS_GNUTAR:
-        extra_params = 4;
+        extra_params = 5;
         break;
     case IS_SAMBA_TAR:
         extra_params = 3;
@@ -1824,6 +1824,7 @@
     case IS_TAR:
     case IS_GNUTAR:
        restore_args[j++] = stralloc("tar");
+ restore_args[j++] = stralloc("--occurrence"); /* do not scan the rest of the archive if file found once */
        restore_args[j++] = stralloc("--numeric-owner");
        restore_args[j++] = stralloc("-xpGvf");
        restore_args[j++] = stralloc("-");      /* data on stdin */




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