| 1 |
gzrecover - Recover data from a corrupted gzip file |
| 2 |
|
| 3 |
gzrecover is a program that will attempt to extract any readable data |
| 4 |
out of a gzip file that has been corrupted. |
| 5 |
|
| 6 |
***************************************************************************** |
| 7 |
ATTENTION!!!! 99% of "corrupted" gzip archives are caused by transferring |
| 8 |
the file via FTP in ASCII mode instead of binary mode. Please re-transfer |
| 9 |
the file in the correct mode first before attempting to recover from a file |
| 10 |
you believe is corrupted. |
| 11 |
***************************************************************************** |
| 12 |
|
| 13 |
It is highly likely that not all data in the file will be successfully |
| 14 |
retrieved. In the event that the compressed file was a tar archive, the |
| 15 |
standard tar program will probably not be able to extract all of the |
| 16 |
files in the recovered file, so you will need to use GNU cpio instead. |
| 17 |
|
| 18 |
For compilation and installation instructions see README.build |
| 19 |
|
| 20 |
USAGE: |
| 21 |
|
| 22 |
gzrecover [ -hpsVv ] [-o <filename>] [filename] |
| 23 |
|
| 24 |
If no input filename is specific, gzrecover reads from the standard input. |
| 25 |
By default, gzrecover writes its output to <filename>.recovered. If the |
| 26 |
original filename ended in .gz, that extension is removed. The default |
| 27 |
output filename when reading from the standard input is "stdin.recovered". |
| 28 |
|
| 29 |
Options include: |
| 30 |
|
| 31 |
-o <name> - Sets the output file name |
| 32 |
-p - Write output to standard output for pipeline support |
| 33 |
-s - Splits each recovered segment into its own file, |
| 34 |
with numeric suffixes (.1, .2, etc) (UNTESTED) |
| 35 |
-h - Print the help message |
| 36 |
-v - Verbose logging on |
| 37 |
-V - Print version number |
| 38 |
|
| 39 |
-o and -p cannot be specified at the same time. |
| 40 |
|
| 41 |
Note that gzrecover will run slower than regular gunzip does, but has |
| 42 |
been significantly inproved in speed since the last release. The more |
| 43 |
corruption in the file, the more slowly it runs. |
| 44 |
|
| 45 |
Running gzrecover on an uncorrupted gzip file should simply uncompress it. |
| 46 |
However, substituting gzrecover for gunzip on a regular basis is not |
| 47 |
recommended. |
| 48 |
|
| 49 |
Any recovered data should be manually verified for validity. There's no |
| 50 |
guarantee anything will be recovered |
| 51 |
|
| 52 |
RECOVERING TAR FILES |
| 53 |
|
| 54 |
If your .gz file is a tar archive, it is likely the recovered file cannot |
| 55 |
be processed by the tar program because tar will choke on any errors in |
| 56 |
the file format. Fortunately, GNU cpio will extract tar files and will |
| 57 |
skip any corrupted bytes. If you don't have GNU cpio on your system, |
| 58 |
you can download it from ftp://ftp.gnu.org/pub/gnu/cpio/cpio-2.6.tar.gz |
| 59 |
Note that I have only tested with version 2.5 or higher. |
| 60 |
|
| 61 |
To extract files, use the following cpio options: |
| 62 |
|
| 63 |
cpio -F <filename from gzrecover output> -i -v |
| 64 |
|
| 65 |
Note that cpio may spew large amounts of error messages to the terminal, |
| 66 |
and may also take a very long time to run on a file that had lots of |
| 67 |
corruption. |
| 68 |
|
| 69 |
Note: I previously had patched the GNU tar sources to enable it to |
| 70 |
skip corrupted bytes, but that patch has been discontinued because it |
| 71 |
is not needed and was only marginally successful at best. |
| 72 |
|
| 73 |
PUTTING IT ALL TOGETHER |
| 74 |
|
| 75 |
Your file foo.tar.gz is on a tape with bad data. To recover, copy the |
| 76 |
tape file to foo.tar.gz and: |
| 77 |
|
| 78 |
gzrecover foo.tar.gz |
| 79 |
cpio -F foo.tar.recovered -i -v |
| 80 |
|
| 81 |
No guarantees, but I hope this helps you as much as it helped me! |
| 82 |
|
| 83 |
KNOWN ISSUES |
| 84 |
|
| 85 |
gzrecover sometimes segfaults on certain files. Neither I nor anyone |
| 86 |
else has been able to track down the source of this. I am looking for files |
| 87 |
of reasonable size for which I can replicate this bug on Linux, so if |
| 88 |
you encounter it with a file that isn't huge, let me know. |
| 89 |
|
| 90 |
COPYRIGHT NOTICE |
| 91 |
|
| 92 |
gzrecover written by Aaron M. Renn ([email protected]) |
| 93 |
Copyright (c) 2002-2013 Aaron M. Renn. |
| 94 |
|
| 95 |
This code is licensed under the same GNU General Public License v2 |
| 96 |
(or at your option, any later version). See |
| 97 |
http://www.gnu.org/licenses/gpl.html |
| 98 |
|