Payments are experiencing issues due to temporary restrictions in Russia. If your payment does not go through, please submit a support request.Our support team is available 24/7 — we are always here to help with hosting and server issues.We are now accepting requests for dedicated server rental and colocation services in our data center.Reminder: we recommend enabling backups for additional data protection.A new VPS/VDS lineup with NVMe storage and improved performance is now available.Maintenance work on some servers has been completed. All services are operating normally.
Article3 min readViews0

How to Verify a tar.gz Archive Before Extraction

Verify the compressed stream and file list separately without extracting the archive over a live site or treating the entire archive as a verified backup.

Storage drives in protective cases for backup storage
In this article

The archive has the expected size and opens in a file manager. This is a useful indicator, but it is worth verifying it more thoroughly before restoration. A tar.gz file has at least two levels: the gzip compressed stream and the tar archive structure inside. Verifying each level solves different tasks.

First, verify gzip

This instruction is designed for GNU gzip and GNU tar on Linux. The file backup.tar.gz is an example of a fully recorded archive name. Before checking, ensure that the backup or copy process has completed.

gzip -t -- backup.tar.gz

The command checks the integrity of the compressed stream without extracting the contents to a directory. Usually, a successful verification does not print a detailed report; for a script, the exit code is what matters. An error must be preserved in the result, not lost due to the next command.

A large archive will be read in its entirety. Consider disk load and do not run multiple verifications simultaneously on a volume that is already experiencing issues.

Check what is inside

For the tar object list:

tar -tzf backup.tar.gz

This is a preview, not an unpacking. Compare the expected directories, names, and presence of required components. For a detailed list with metadata, use the variant -tvzf.

If the list is too large, first clarify the backup composition based on its description. Skipping output through a program that terminates after the first few lines can interrupt archive reading before the end. Such viewing must not be presented as a full verification of the entire contents.

Verify the meaning of the contents

Assume the archive is intact but contains only website files without a database. This may suffice for a static project, but not for an online store. You need to know which components are included in the accepted backup scheme and how they are synchronized in time.

Look for unexpected absolute paths, parent directory transitions, and symbolic links. An untrusted archive should not be extracted with elevated privileges into a working directory. Checking the list does not make its contents safe for execution.

What these commands do not prove

Success in gzip verification and tar reading does not guarantee business database integrity, configuration suitability, or the ability to run the application. Even a complete list of expected files does not confirm that the backup was created in a consistent state.

Separate verification of restoration in an isolated environment is required. There, application startup and control data are evaluated without sending real emails or contacting live payment services. This instruction does not perform restoration.

How to Record the Result

Record the archive name, creation time, size, gzip check result, and tar structure read result. If a trusted checksum exists, add its comparison as a separate item. Do not label the archive as a verified restoration if you have only read the file list.

In case of an error, save the original file and the error message, then verify the source and the transfer process. Do not unpack a corrupted archive over an active site, hoping that "core files are intact." The purpose of preliminary control is to identify the issue before restoration begins modifying live data.

Discussion0

Share your experience and ask questions. Comments without links appear after editorial review.

No comments yet. Start the discussion.