LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 09-09-2009, 09:33 PM   #1
Mo-regard
LQ Newbie
 
Registered: May 2009
Posts: 5

Rep: Reputation: 0
Cannot extract a tarfile that I created, error states stdin: not in gzip format


I had a number of .iso images that I mounted to a loopback device to a single directory. I then took that directory(and all sub directories) and ran the TAR command(see below) to compress and transfer them to a NAS over the network. When I copied the file (it is 38GB) back to the server and attempted to extract them using TAR I recieved an

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors

i then ran the file command (see below) and it returned a value back of "data"

How can I retrieve the data? Below is listing of all the command that I ran to mount, and then compress, copy to the NAS.


Background.
1. We copied the DVD using the dd command to an image file
nohup dd if=/dev/scdx of=/mnt/yyyymmdd.iso

2. Then mounted a number of the images above to a directory
mount –t iso9660 –o loop=/dev/loopX / mnt/yyyymmdd.iso /mnt/yyyymmdd where x=loop number i.e. /dev/loop2

3. Once the images where mounted we were able to see the file structure. We mounted multiple disks to in a directory structure then used the tar command to compress and copy the directory over to the NAS via the network
nohup tar cvzf - * | ssh root@nas \ ‘cd /Data; cat > filename.gz’


When I copied the file back to the server to uncompress it I receive the following errors.



root@secant:/Mo3# tar -xzf 9-2.gz

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors


Then I tried to rename it.

root@secant:/Mo3# mv 9-2.gz 9-2.tar.gz
root@secant:/Mo3# tar -xzf 9-2.tar.gz
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors
root@secant:/Mo3# tar xzf 9-2.tar.gz

When I ran the file command it told me it was format of “Data”


root@secant:/Mo3# file 9-2.tar.tgz
9-2.tar.tgz: data

Have been hunting around for a solution, but have not been successful. Any thoughts?
I don’t think it is an image file, I believe that it has compressed, but I can’t get extracted.
 
Old 09-10-2009, 03:29 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2013.07, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,176

Rep: Reputation: 2356Reputation: 2356Reputation: 2356Reputation: 2356Reputation: 2356Reputation: 2356Reputation: 2356Reputation: 2356Reputation: 2356Reputation: 2356Reputation: 2356
Unpacking

1) file.tar : 'tar xvf file.tar'
2) file.tar.gz : 'tar xvf file.tar.gz' ( older systems : tar zxvf )
3) file.tgz : 'tar xvf file.tgz' ( older systems : tar zxvf )
4) file.tar.bz : 'tar xvf file.tar.bz' ( older systems : tar jxvf )

5) file.gz : 'gunzip file.gz'

Please read 'man tar' and 'man gunzip'
.....

Last edited by knudfl; 09-10-2009 at 03:31 AM.
 
Old 09-10-2009, 09:07 AM   #3
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,566

Rep: Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510
sounds like it's not gzipped. just untar it
 
1 members found this post helpful.
Old 09-10-2009, 09:37 AM   #4
lbukys
LQ Newbie
 
Registered: Mar 2008
Posts: 8

Rep: Reputation: 0
things to try

Perhaps it was mangled on the way into the NAS via SSH, or mangled when copied from the NAS. Here are a couple of things to try:
  • Run this:
    od -c 9-2.gz | head
    and tell us what it says. Maybe it will reveal that it wasn't compressed. (Forgot the tar 'z' option when created?)
  • Copy the histogramming (character frequency counting) perl script below into "hist.pl" and run:
    perl hist.pl 9-2.gz
    and tell us what it says. For a gzip file of any substantial size, you should see some occurrences of every character value from 0 to 255. If your copy into the NAS or out of the NAS messes with line terminators, you may see things like all CR deleted, or all CR mapped to LF. (If this is the problem, it is possible to recover -- I have done it before -- but it requires extreme effort, only worthwhile if it's truly critical data. There's an discussion of how at http://bukys.com/services/recovery/examples/].)
  • How are you copying your files from the NAS? NFS mount? Something else?
    Does this command:
    ssh root@NAS "cat /Data/filename.gz"
    produce the same file?

Here's my hist.pl perl script:

Code:
#!/usr/bin/perl -w
use strict;

die "filename arguments expected\n" if ($#ARGV < 0);

foreach my $filename (@ARGV) {
    if (!open IN, "<$filename") {
        warn "can't open '$filename'\n";
        next;
    }
    print "$filename\n";
    binmode(IN);
    my @hist = ();
    my $total = 0;
    while (read IN, my $buf, 1024) {
        foreach my $octet (unpack "C*", $buf) {
            $hist[$octet]++;
            $total++;
        }
    }
    close(IN);

    for (my $i = 0;  $i < 256;  $i++) {
        my $count = $hist[$i] || 0;
        my $p = sprintf("%.5f", $count/$total);
        print "[$i] $count $p\n";
    }
    print "total $total\n\n";
}
exit 0;
 
Old 09-22-2009, 11:51 AM   #5
Mo-regard
LQ Newbie
 
Registered: May 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Resolved, the files where corrupt

Thanks for your help everyone, but the files on the NAS ended up being corrupt.
 
  


Reply

Tags
copy, corrupt, gzip, iso, mounted, recovery, ssh, tar


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gzip: stdin: invalid compressed data--format violated ftp ascii transfer sridhar_dct3 Linux - Software 10 07-28-2012 02:25 PM
"gzip: stdin: unexpected end of file" when untaring Niflheim Linux - Newbie 8 11-12-2007 07:05 PM
FC 6: gunzip: stdin: invalid compressed data--format violated jnonaka Linux - Newbie 14 03-23-2007 02:24 PM
apt-get update error: "gzip: stdin: not in gzip format" haertig Debian 0 08-02-2006 05:21 PM
Not in gzip format, after attempting gunzip libstdc++-libc6.1-2.so.3.gz ukrainet Linux - Newbie 5 11-19-2004 07:34 AM


All times are GMT -5. The time now is 11:20 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration