[NCLUG] fixing corrupt cpio archive

S. Luke Jones luke at frii.com
Sun Nov 18 09:05:24 MST 2001


Any uncompress/gunzip gurus out there? How about cpio experts?

Back in the day, I had some files I wanted to keep around forever
so I stored them as compress'ed cpio archives. (Dumb twice, but
there it is.)

Nobody has uncompress anymore (thanks a lot, Unisys) but gunzip
has the equivalent capability. Some of the .cpio.Z files give me

$ gunzip foo.cpio.Z 
gunzip: foo.cpio.Z: corrupt input. Use zcat to recover some data.

and the man page is pretty unhelpful. (It says zcat will read up
to the point of failure, but no hints as to how to skip the bad
part and continue on after. Perhaps that's not possible with .Z
files, but I'm hoping it is.)

Not all the .cpio.Z files got corrupted that way. Some have a
different type of problem:

$ file bar.cpio 
bar.cpio: ASCII cpio archive (pre-SVR4 or odc)

and when I do (excuse the useless use of cat)

$ zcat bar.cpio.Z | cpio -i -t -d -H odc
-rw-r-Sr--   1 719      124          1166 Mar  3  1989 graphics.two/clipper.c
-rw-r-Sr--   1 719      124           657 Feb 22  1989 graphics.two/legal.c
-rw-r-Sr--   1 719      124           892 Mar  3  1989 graphics.two/liggs.c
cpio: warning: skipped 1247 bytes of junk
-rw-r-Sr--   1 719      124          3925 Mar 21  1989 graphics.two/omath.cpp
cpio: warning: skipped 1 bytes of junk
-rw-r-Sr--   1 719      124         15526 Mar  3  1989 graphics.two/menu.c
cpio: premature end of file

so I was hoping there was some way of figuring out why the end
of file was unexpected and if that means anything is actually
missing.
-- 
Luke Jones  luke vortex frii fullstop com



More information about the NCLUG mailing list