How can I check a tar file on my server for corruption?
When working with a tar file, such as when manually unzipped or using the file to restore an account, you may get an error similar to the following:
Failed to extract the archive at /home/backup.tar.gz: The tar archive
extraction failed because of the error "The '/usr/bin/gtar' command
(process 12345) reported error number 2 when it ended."
pigz: skipping: <stdin>: corrupted -- incomplete deflate data
This can be an indicator of corruption in the tar file itself. To confirm this you can run the following command against the tar file:
tar tzf /full/path/to/tar.gz
This will scan the file without unzipping the data, and will let you know if there are any errors. If you see output similar to the following:
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
that indicates the tar file itself is corrupted and can't be opened properly. In this situation you would need to recreate the tar file from the original source files.