I am compressing log files daily and very recently I have been seeing some crazy results on the file type of the file after compression.

Normally you would expect file filename.gz returning gzip compressed data and some info on the file, but on many files I am seeing just "data", "raw G3 data, byte-padded", "DBase 3 index file" random stuff.

Any issues anyone could think of that could be causing this? I can't decompress the file then because it is not recognized as a gzip file

It is really bizarre why this is happening

To Add: The file also comes up as corrupt in many cases. When doing a gzip -d I either cannot decompress it because it says not recognized or it is actually corrupt. This never happened before, I know it is possible for a file to compress corrupt, but there must be something going on in which the frequency has increased to multiple files a day being corrupt whereas before it wasn't even one a year.

  • I have a suggesstion, According to you have been compressed, compress and use $? – PersianGulf Mar 28 '15 at 3:51
  • 1
    Remember that the file command examines part of the data to try to make a determination. It is possible that a compressed file contains data that makes the file command think that it is another type of file. Thus there is nothing wrong here. Anyway in UNIX/Linux a file is just an ordered collection of bits, an application program determines what to do with this data and in what form. The file command is ultimately only a guessimate. – mdpc Mar 28 '15 at 6:24

The fact that you:

can't decompress the file then because it is not recognized as a gzip file

indicates that this is not a quirk of the file command misdetecting the file format. The file is actually not valid or it is corrupt.

If these files were generated with normal gzip with no errors reported and normal gunzip cannot then decompress them then your file system or memory or CPU or disk is introducing corruption and you should be very concerned about that. Check the kernel logs for filesystem and other errors and unmount and check your filesystem as soon as possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.