Question
How can you test the integrity of TAR and ZIP files?
Answer
These file types are often used for backups or general safe-keeping of files or directories.
If you ever need to restore the content from these files, you should check for the integrity of these files to ensure no corruption has occurred that could prevent you from retrieving the content.
What command you run depends on the type of archive:
Note: You need to replace FILE with the location of the tar or zip file you want to test the integrity of.
# tar -tf FILE.tar 1>/dev/null
# tar -tzf FILE.tar.gz 1>/dev/null
# unzip -t FILE.zip
If any corruption is found, it may be presented as follows:
CONFIG_TEXT: tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
CONFIG_TEXT: warning [$TARBALL.zip]: 11879186 extra bytes at beginning or within zipfile
(attempting to process anyway)
error [$TARBALL.zip]: start of central directory not found;
zipfile corrupt. \
Once corruption is found in these files, you will need to either obtain a copy without issues or create a new backup.
Comments
0 comments
Article is closed for comments.