BackupPC_tarCreate without deecompression

Aleksandar Ivanisevic <[email protected]>
Newsgroups gmane.comp.sysutils.backup.backuppc.devel
Organization Individual
Message-ID <[email protected]>

Hi,

If I want to create an compressed archive from a backuppc backup I
have to use a tarCreate and then pipe the output to whatever
compression utility I desire. Since backuppc backups are already
compressed this is a bit of an overkill since each file is first
decompressed, then tarred and then compressed again.

Wouldn't it be much faster to just copy over the compressed files and
then decompress them at restore time with BackupPC_zcat?

The obvious disadvantage is that one needs a copy of backuppc to
restore, but I guess a standalone zcat utility shouldn't be too hard
to cut out.

This is the patch, it seems to create valid archives and im able to
BackupPC_zcat individual files. Before I start testing the restore,
does anyone see anything wrong in my thinking?

--- BackupPC_tarCreate	2008-12-06 12:44:28.000000000 +0100
+++ BackupPC_tarCreate_noDecompress	2009-08-19 09:16:38.000000000 +0200
@@ -462,17 +462,17 @@
         #
         # Regular file: write the header and file
         #
-        my $f = BackupPC::FileZIO->open($hdr->{fullPath}, 0, $hdr->{compress});
-        if ( !defined($f) ) {
+        if ( ! open (IN, "<", $hdr->{fullPath})) {
             print(STDERR "Unable to open file $hdr->{fullPath}\n");
             $ErrorCnt++;
 	    return;
         }
+        $hdr->{size} = -s $hdr->{fullPath};
         TarWriteFileInfo($fh, $hdr);
         if ( $opts{l} || $opts{L} ) {
             $size = $hdr->{size};
         } else {
-            while ( $f->read(\$data, $BufSize) > 0 ) {
+            while ( read(IN, $data, $BufSize) > 0 ) {
                 if ( $size + length($data) > $hdr->{size} ) {
                     print(STDERR "Error: truncating $hdr->{fullPath} to"
                                . " $hdr->{size} bytes\n");
@@ -482,7 +482,7 @@
                 TarWrite($fh, \$data);
                 $size += length($data);
             }
-            $f->close;
+            close IN;
             if ( $size != $hdr->{size} ) {
                 print(STDERR "Error: padding $hdr->{fullPath} to $hdr->{size}"
                            . " bytes from $size bytes\n");


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
BackupPC-devel mailing list
[email protected]
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-devel
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.