[SOLVED] gzip: stdin: unexpected end of file

General support questions including new installations
Post Reply
hoodcanaljim
Posts: 312
Joined: 2006/02/05 17:49:10

[SOLVED] gzip: stdin: unexpected end of file

Post by hoodcanaljim » 2012/01/05 02:51:44

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

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: gzip: stdin: unexpected end of file

Post by pschaff » 2012/01/05 03:38:55

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.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: gzip: stdin: unexpected end of file

Post by TrevorH » 2012/01/05 09:34:26

[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...

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

[SOLVED] gzip: stdin: unexpected end of file

Post by gerald_clark » 2012/01/05 14:54:08

If the disk in /media is VFAT, the tar file may be too big.

hoodcanaljim
Posts: 312
Joined: 2006/02/05 17:49:10

Re: gzip: stdin: unexpected end of file

Post by hoodcanaljim » 2012/01/05 17:11:55

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

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: gzip: stdin: unexpected end of file

Post by gerald_clark » 2012/01/05 17:25:45

That's the problem.
You could pipe the tar command through split.

hoodcanaljim
Posts: 312
Joined: 2006/02/05 17:49:10

Re: gzip: stdin: unexpected end of file

Post by hoodcanaljim » 2012/01/05 23:10:36

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.

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

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

Post by AlanBartlett » 2012/01/06 01:22:57

Thank you for reporting back.

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

Post Reply