How to recover a corrupt cpio archive

View: New views
3 Messages — Rating Filter:   Alert me  

How to recover a corrupt cpio archive

by Christopher Michaels-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello list,

It seems that an archive written in copy out mode with cpio (GNU
cpio) 2.6 is corrupt, The command used was simply:

  $ find . -depth -print | cpio -ov >backup.cpio
  [...]
  home/sharedsys/newfiles/test.ps
  home/sharedsys/newfiles
  home/sharedsys
  home/
  824190054 blocks

...just as suggested by O'Reilly:

  http://www.onlamp.com/pub/a/bsd/2002/07/11/FreeBSD_Basics.html

When restoring in copy out mode with the identical cpio(1) binary
as used for the backup:

  $ cpio -ivd <backup.cpio
  ./home/backfiles/otheruse/usr/etc/mutt/mime.types
  ./home/sharedsys
  ./$e~OÉÃ>~GðA1°~I*}J~P±\~WgÊb~RJGùoCqâÃ^BkïJÌ~X^UcbHH.;²ñ~[uÖ
  ./ÈB0)°Ñ~@Ò~K^N¸¡n^^^\^QÙ;^]³^]çü~NåMæ~[~J^Z[~Kp~ÿð^
  ./@B~]w^Xæá³ÌÍì^D^KÃr­~H~K§h¢2:~Q_>á^Z[Ó4^Nó~O^Wò^_!~D§øÌ®

When a newer version of cpio (GNU cpio) 2.9 is used for the restore:

  $ cpio -ivd <backup.cpio
  home/backfiles/otheruse/home/parsed/segsulin.xml
  home/backfiles/otheruse/home/parsed/segsulin.tar
  cpio: premature end of file

Either way nearly all of the archive contents are not restored.

What is the suggested way out of this big mess, and how does one
usually recover from such cpio archive corruption? Should I stop
using cpio(1) for all important backups?

Thanks for the help.

Regards,
Christopher


_______________________________________________
Bug-cpio mailing list
Bug-cpio@...
http://lists.gnu.org/mailman/listinfo/bug-cpio

Re: How to recover a corrupt cpio archive

by Sergey Poznyakoff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, Christopher

> It seems that an archive written in copy out mode with cpio (GNU
> cpio) 2.6 is corrupt, The command used was simply:
>
>   $ find . -depth -print | cpio -ov >backup.cpio
>   [...]
>   home/sharedsys/newfiles/test.ps
>   home/sharedsys/newfiles
>   home/sharedsys
>   home/
>   824190054 blocks

Did cpio -t (on the same machine) show the contents of this archive
without errors?

> ...just as suggested by O'Reilly:
>
>   http://www.onlamp.com/pub/a/bsd/2002/07/11/FreeBSD_Basics.html
>
> When restoring in copy out mode with the identical cpio(1) binary
> as used for the backup:

That is to say, you were using another cpio binary for restoring, right?
If so, what version of cpio was it?

Regards,
Sergey


_______________________________________________
Bug-cpio mailing list
Bug-cpio@...
http://lists.gnu.org/mailman/listinfo/bug-cpio

Re: How to recover a corrupt cpio archive

by Christopher Michaels-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello Sergey,

On Wed, Jun 04, 2008, Sergey POZNYAKOFF wrote:

>> It seems that an archive written in copy out mode with cpio (GNU
>> cpio) 2.6 is corrupt, The command used was simply:
>>
>>   $ find . -depth -print | cpio -ov >backup.cpio
>>   [...]
>>   home/sharedsys/newfiles/test.ps
>>   home/sharedsys/newfiles
>>   home/sharedsys
>>   home/
>>   824190054 blocks
>>
>Did cpio -t (on the same machine) show the contents of this archive
>without errors?
>
Both '-t' and '-i' options have the same text output, so the answer
is no.

>> ...just as suggested by O'Reilly:
>>
>>   http://www.onlamp.com/pub/a/bsd/2002/07/11/FreeBSD_Basics.html
>>
>> When restoring in copy out mode with the identical cpio(1) binary
>> as used for the backup:
>
>That is to say, you were using another cpio binary for restoring, right?
>If so, what version of cpio was it?
>
The system cpio(1) was used to back up the files, and then the
operating system was updated. The backup was needed because during
the OS update a new RAID type was used, causing the hard drives to
be wiped clean. When the new OS was installed, a newer version of
cpio(1) called (GNU cpio) 2.9 came with it. This is the version used
at first. When problems arose, the exact original binary from the
previous OS was used. It is called cpio (GNU cpio) 2.6.

By the way, after using pax(1) it seems that most of the data
has been restored. At least a few important directories were
lost however, which is not a very good track record for cpio(1).
I'm still wondering where it all went wrong.

Regards,
Christopher


_______________________________________________
Bug-cpio mailing list
Bug-cpio@...
http://lists.gnu.org/mailman/listinfo/bug-cpio