当试图从tar文件中提取所有文件时,出现以下错误信息:
tar: Skipping to next header tar: Error exit delayed from previous errors
在打印此错误消息之前,某些文件会正确提取,并且进程会导致似乎包含归档文件其余部分的乱码文件。 这个档案中的所有文件都是文本文件。
有什么我可以尝试恢复其余的文件?
您可以尝试使用-i选项提取忽略零:
The --ignore-zeros (-i) option causes tar to ignore blocks of zeros in the archive. Normally a block of zeros indicates the end of the archive, but when reading a damaged archive, or one which was created by cat-ing several archives together, this option allows tar to read the entire archive. This option is not on by default because many versions of tar write garbage after the zeroed blocks.
你可以尝试其他版本的tar:gnu tar,star,bsdtar等,其中一个可能会更好地处理错误。
你说你的文件都是文本文件,所以你应该可以手动编辑文件并select每个文件并复制/粘贴到一个新的文件。 在每个文件之间寻找tar的分隔符,它看起来像一个embedded了文件元数据(名称,权限,时间戳等)的ASCII NULL的块。
这不是很好,但它将作为最后的手段:
安装“photorec”可能包含在你的发行版本的“testing盘”包中(两者都可以在这里find)。
input"photorec <foo.tar>"并按照提示进行操作(对于filesytem选项,请select“无 – 非分区媒体”和“其他”)。 它应该能够恢复很多文件,但是您必须手动识别并重命名它们。 至less它打败了一切。 (作为参考,我打了我的/ etc目录,试了一下,即使在一个没有损坏的tar文件里,它也只有337个文件中的225个,甚至其中的一些相当地被压缩了。
更强大的方法是运行"strings foo.tar > out.txt"来从文件中恢复文本数据,然后需要对文件进行sorting并手工放回到单独的文件中。
顺便说一句…谷歌关于“恢复损坏的tar文件”产生了特定于您的问题的几个工具。