Page 1 of 1

[SOLVED] gzip: stdin: unexpected end of file

Posted: 2012/01/05 02:51:44
by hoodcanaljim
Hi

I preparation for upgrading my desktop machine from 5.7 to 6.2 I am backing up my /home files and /etc directories. But there are problems with the tar files I am creating. When run the following tar command and then try to get a listing of that file it shows this error.

[code]
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
[/code]
This is the command used to create the file
[code]
tar -cvzf /media/disk-1/ZZ.linux.d/pri/pri.music.tgz /home/music
[/code]

When I run the command
[code]
ls -R /home/music | wc -l
[/code]
it returns 2080

When I run the command
[code]
tar -tzvf /media/disk-1/ZZ.linux.d/pri/pri.music.tgz | wc -l
[/code]
it returns 721 and the above error.

Am I looking at apples and oranges??
Is there a way to get tar to explain the errors??

It would appear there is something in the directory being tar'ed that creates the error because tar'ing the /etc directory and listing that tar gives no errors.

Thanks
Jim

Re: gzip: stdin: unexpected end of file

Posted: 2012/01/05 03:38:55
by pschaff
The difference in line count is no surprise and is due to the difference in handling of directories in "ls -l" versus "tar -tv". The "-" is optional on tar options - a bit of an oddity. What happens if you omit it? Nothing in my test.
[code]
[build@poq1 ~]$ ls -R rpmbuild/
rpmbuild/:
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS tmp

rpmbuild/BUILD:

rpmbuild/BUILDROOT:

rpmbuild/RPMS:
x86_64

rpmbuild/RPMS/x86_64:

rpmbuild/SOURCES:

rpmbuild/SPECS:

rpmbuild/SRPMS:

rpmbuild/tmp:
test
[build@poq1 ~]$ tar zcf test.tgz rpmbuild/
[build@poq1 ~]$ tar ztvf test.tgz
drwxrwxr-x build/build 0 2011-12-14 07:26 rpmbuild/
drwxrwxr-x build/build 0 2011-12-21 17:48 rpmbuild/RPMS/
drwxr-xr-x build/build 0 2012-01-04 22:26 rpmbuild/RPMS/x86_64/
drwxrwxr-x build/build 0 2012-01-04 22:26 rpmbuild/SRPMS/
drwxrwxr-x build/build 0 2012-01-04 22:27 rpmbuild/SPECS/
drwxr-xr-x build/build 0 2012-01-04 22:27 rpmbuild/tmp/
-rw-rw-r-- build/build 0 2012-01-04 22:27 rpmbuild/tmp/test
drwxr-xr-x build/build 0 2012-01-03 13:33 rpmbuild/BUILDROOT/
drwxrwxr-x build/build 0 2012-01-04 22:27 rpmbuild/BUILD/
drwxrwxr-x build/build 0 2012-01-04 22:27 rpmbuild/SOURCES/
[build@poq1 ~]$ tar ztvf test.tgz | wc -l
10
[build@poq1 ~]$ tar -ztvf test.tgz | wc -l
10
[build@poq1 ~]$ ls -R rpmbuild/ | wc -l
26
[build@poq1 ~]$
[/code]Perhaps you are right about the content of the archive being the issue, but I don't know what would cause that.

Re: gzip: stdin: unexpected end of file

Posted: 2012/01/05 09:34:26
by TrevorH
[quote]
hoodcanaljim wrote:

This is the command used to create the file
[code]
tar -cvzf /media/disk-1/ZZ.linux.d/pri/pri.music.tgz /home/music
[/code]
[/quote]

Are you sure that this command actually completes successfully and creates the archive? The only time I've seen things like you report is when the target file resides on a filesystem that runs out of space...

[SOLVED] gzip: stdin: unexpected end of file

Posted: 2012/01/05 14:54:08
by gerald_clark
If the disk in /media is VFAT, the tar file may be too big.

Re: gzip: stdin: unexpected end of file

Posted: 2012/01/05 17:11:55
by hoodcanaljim
If the limit on a VFAT drive is 4.0g then that is the problem. I was able to copy all the files onto the external drive, 12g of them. But the tar files are stopped at 4.0g.


Thanks
Jim

Re: gzip: stdin: unexpected end of file

Posted: 2012/01/05 17:25:45
by gerald_clark
That's the problem.
You could pipe the tar command through split.

Re: gzip: stdin: unexpected end of file

Posted: 2012/01/05 23:10:36
by hoodcanaljim
Thanks for all the help.

I am past this problem since I copied all the files onto to backup drive. I should be good to install 6.2 and reload files as required.


Thanks again Trevor, Gerald and Phil
Jim

This could be marked SOLVED.

Re: [SOLVED] gzip: stdin: unexpected end of file

Posted: 2012/01/06 01:22:57
by AlanBartlett
Thank you for reporting back.

[quote]
This could be marked SOLVED.
[/quote]
Done, as requested. :-)