Sponsored Content
Top Forums UNIX for Dummies Questions & Answers may a corrupted .gz file be repaired? Post 302176918 by lbukys on Wednesday 19th of March 2008 03:03:21 PM
Old 03-19-2008
Lightbulb fixing corrupt gzip files

[This forum posting is two years late, but I'm adding it because this is a frequently asked question and somebody out there may search for it again and find some hope.]

It is very difficult to fix gzip files corrupted by FTP ASCII transfer. The problem is that (on average) 1/256 of the bytes have 3/8 of their bits flipped, and there is no way to distinguish whether one of those CR/LF bytes was supposed to be the way it is, or got that way by the ASCII transfer - so it can't be inverted in any simple way.

So-called zip recovery programs only fix CRC/checksum errors (to avoid error messages), they don't actually fix the data. That's only useful if the file is truncated or has a bad block late in the compressed data. It doesn't work for which about 1/256 of their bytes are corrupted, throughout the file.

So for 99% of the cases, give up, find the original if you can, and re-transfer in binary mode.

Despite what I said above, there is a computationally expensive way to search for the necessary repair. However, it requires custom coding of a search heuristic, and lots of computation. Therefore it's not a turn-key process. It's only feasible if you have no other backup and the data is so critical that you're willing to invest in some custom coding. I documented some details on what it took to recover a pile of 20MB gzip files containing 250MB million-line web server logs, at my web site.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

corrupted tar file

Hi all, I've got a corrupted tar file with some filename being like ?a=n is it possible to get them repaired? (1 Reply)
Discussion started by: klintsovi
1 Replies

2. Shell Programming and Scripting

detecting corrupted file

Hello, Newbie question: How can I detect a corrupted file from a script (ksh)? Thank you, Martin (6 Replies)
Discussion started by: starless
6 Replies

3. HP-UX

passwd file corrupted

Good Day Our HP box was hacked and the passwd file has been altered,there are only 2 user accounts active,and these dont have any administrative rights.I need to edit the passwd file to correct the su and root entries. Does any body have any suggestions as to how i can do this with out the root... (10 Replies)
Discussion started by: cantona7
10 Replies

4. UNIX for Dummies Questions & Answers

Help! passwd file corrupted

Hi, I am new to UNIX, and have recently installed Suse 9.3. I have been experimenting with all of the commands and have somehow managed to modify the default shell of the root user to an invalid file. Consequently I cannot su to the root user as I receive the 'no such file or directory' error... (2 Replies)
Discussion started by: Tony Montana
2 Replies

5. HP-UX

Could be a corrupted file?

Hello! Do you know the meaning of... "crw-rw---- 1 informix informix 64 0x020001 Jan 21 2004 rifxroot" I don't know what the first "c" means. Furthermor, if I try to copy this file (rifxroot) it appears a message: "cp: cannot open rifxroot: No such device or address" I don't... (1 Reply)
Discussion started by: kaugrs
1 Replies

6. Solaris

WTMPX File corrupted

Hi All I work on solaris 8, 9 and 10 platforms and have encountered an error which is my wtmpx files appear to be corrupted as all entries contain the date 1970 (the birth of unix). Now this is obviously not the case, so my query is: 1 - Can the existing wtmpx files be manipulated to... (6 Replies)
Discussion started by: drestarr96
6 Replies

7. Red Hat

.bash_profile file corrupted

Hi, Unexpectedly i entered wrong entries in .bash_profile for my user which has administrative permissions. So, i am getting errors for every command. I dont have backup file also, so any body can help me how to recover it. Regards, Mastan (7 Replies)
Discussion started by: mastansaheb
7 Replies

8. Web Development

Mysql table is marked as crashed and should be repaired

140312 13:43:54 /usr/libexec/mysqld: Table './***/phpbb_posts' is marked as crashed and should be repaired Its mysqld.log in var/log alot of messages, but before around hour i tried to "repaid table" from within phpmyadmin, but appears it has no effect.. why? How to fix? (1 Reply)
Discussion started by: postcd
1 Replies

9. UNIX for Dummies Questions & Answers

After Ftp'ing file to destination how to check the file if it is in correct ASCII and not corrupted

Hi Folks, While transferring file from FTP software like Filezilla the files gets corrupted. Is there any way I can check if the recently transferred file is in ASCII and not corrupted. I have tried using file -i filename command which does tell if the file character set is ASCII or binary... (6 Replies)
Discussion started by: Khan28
6 Replies
INNCHECK(8)						      System Manager's Manual						       INNCHECK(8)

NAME
inncheck - check inn configuration and database files. SYNOPSIS
inncheck [ -a ] [ -v ] [ -pedantic ] [ -f ] [ -perm ] [ -noperm ] [ file=value | file ] DESCRIPTION
Inncheck examines various configuration files and databases and verifies things about them. Things verified depend on the file being checked, but generally are things like permissions, ownership, syntax errors in config files etc. Inncheck does not make changes to any files -- it just reports what it thinks may be wrong, and it is up to the operator to fix the prob- lem. The set of files checked may be restricted by using file or file=value arguments. For example, putting incoming.conf causes only the incom- ing.conf(5) file to be checked. Using incoming.conf=/tmp/incoming.conf on the command line will cause inncheck to only verify the incom- ing.conf file, and it will perform the checks on the file /tmp/incoming.conf file instead of the default one. Valid values for file are: active control.ctl expire.ctl incoming.conf inn.conf moderators newsfeeds overview.fmt nntpsend.ctl passwd.nntp OPTIONS
-a If any ``file'' value or ``file=value'' pairs (see below) are given, then normally only the files they refer to are checked. Use the ``-a'' flag to specify that all files should be checked regardless. In this case the form file=value will be the more useful. -v Use the ``-v'' option to get more verbose output. -pedantic Use the ``-pedantic'' option to get reports on things that are not necessarily wrong, but may indicate a bad configuration -- such as inn.conf(5) missing a key. -f Use the ``-f'' flag to have inncheck print the appropriate chown/chgrp/chmod command necessary to fix a problem that it reports. Any other output lines will be prefixed with a ``#'' character to make the output be valid input for a shell. Note that the ``-perm'' flag must be used as well when using this flag. -perm Inncheck checks all files for permission problems. If the ``-perm'' flag is used, then only the files specified by the file or file=value command line arguments will be checked for problems other than permission problems. -noperm To avoid doing any checking of file permissions or ownership, use the ``-noperm'' option. EXAMPLES
To have inncheck check all files for syntax and permission problems simply: inncheck To have inncheck check all files for permission problems and to verify the syntax of the active and incoming.conf files do: inncheck -perm active incoming.conf To have inncheck check the test newsfeeds file in /var/tmp/newsfeeds.testing, do: inncheck newsfeeds=/var/tmp/newsfeeds.testing To have inncheck check all the files as it normally does, but to specify a different location for the newsfeeds file, so: inncheck -a newsfeeds=/var/tmp/newsfeeds.testing BUGS
If the ``-f'' and ``-perm'' options are used together, along with ``-a'' or some ``file'' or ``file=value'' arguments that refer to a file with a syntax problem, then the output will no longer be valid input for a shell. HISTORY
Written by Brendan Kehoe <brendan@cygnus.com> and Rich Salz <rsalz@uunet.uu.net> This is revision 1.5, dated 1998/10/30. SEE ALSO
active(5), expire.ctl(5), history(5), incoming.conf(5), inn.conf(5), newsfeeds(5) INNCHECK(8)
All times are GMT -4. The time now is 08:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy