
A backup can download successfully, have the expected filename and byte count, and still be the wrong backup. To verify an S3 download, calculate a SHA-256 checksum of the finished source file before you upload it. Save that value somewhere you trust. After downloading, calculate SHA-256 over the restored file and compare the two values.
In our restore drill, a single-part upload and a two-part upload gave the same 5,255,225-byte file different ETags. Both downloads passed the original checksum. Replacing one byte under the same object key kept the file size identical and made the check fail. Retrieving the original version made it pass again.
Use a small, expendable file for the first run. The commands below use Bash, GNU sha256sum, and the AWS CLI. Start in a new working directory. Put the finished file in source/backup.bin and run the steps in order. If your backup job compresses or encrypts the file before upload, hash the resulting archive after the job has closed it. Those are the bytes you will retrieve.
set -eu
mkdir expected restored
(cd source && sha256sum --binary backup.bin) > expected/SHA256SUMS
The manifest contains a 64-character hexadecimal digest and the filename backup.bin. Computing it from inside source keeps the source directory out of the filename. Later, you can run the same check from inside restored without renaming your original or editing the manifest.
For a real backup, keep this manifest in a protected backup catalog or signed release record. Record the bucket, full object key, byte count, and version ID when available. Someone who can replace both a backup and its reference digest can make a substitute pass, so give the people and jobs that upload objects separate permissions from those that approve the reference.
Configure the AWS CLI with the credentials and region for your test bucket. Set ENDPOINT to the service URL supplied by your provider, BUCKET to the test bucket name, and KEY to a new, unused key such as restore-drills/run-001/backup.bin. For Amazon S3 using its standard regional endpoint, omit --endpoint-url "$ENDPOINT". This small test uses a single PUT. For an existing backup with a trusted manifest, skip the upload and use its recorded key.
aws --endpoint-url "$ENDPOINT" s3api put-object \
--bucket "$BUCKET" --key "$KEY" --body source/backup.bin \
> expected/upload.json
Keep the upload response. In a bucket with versioning enabled, it can supply the version ID you will need if another job writes to the same key. Now download the entire object into the separate restore directory. The command writes the file to backup.bin and sends the response metadata to response.json.
aws --endpoint-url "$ENDPOINT" s3api get-object \
--bucket "$BUCKET" --key "$KEY" \
restored/backup.bin > restored/response.json
(cd restored && sha256sum --check ../expected/SHA256SUMS)
A matching file prints backup.bin: OK and the check exits with status 0. Use that exit status in a restore job. A successful GET alone tells you that the service returned an object. If the checksum command says it cannot find the file, check the working directory and filename before diagnosing a data mismatch. The AWS CLI get-object reference documents the output file, byte ranges, and version selection.
An ETag identifies an object representation. On Amazon S3, an ETag can equal the MD5 digest for certain single-part uploads, depending on encryption. A multipart ETag is not the MD5 digest of the complete file. Treat the ETag as an opaque value unless your comparison specifically calls for an ETag. It cannot replace the SHA-256 recorded by your backup job.
We ran the CLI against a local Moto S3 simulator. The first upload sent the file in one request. The second sent a 5 MiB first part and a 12,345-byte final part. The single-part ETag was 7e630ecc494cf7390c9a834ab602f335. The multipart ETag was 63e6d50d3dfcbf4b79fbb451a2322b97-2. Both downloads matched this full-file SHA-256:
41cbe98c8d9d66c6db44edb229642582d9c8dd5706283d5e71b914674d89562f
If you need to change how a large file is split or retry an interrupted upload, see the S3 multipart upload guide. You can use the same trusted manifest to verify the resulting download regardless of the part sizes.
Amazon S3 can store checksum values as object metadata. For an AWS bucket, the following read-only request shows the checksum type and selected algorithms when those values are available. Use the same version ID as the download if you are inspecting an older version.
aws s3api head-object --bucket "$BUCKET" --key "$KEY" \
--checksum-mode ENABLED \
--query '{Type:ChecksumType,SHA256:ChecksumSHA256,CRC32:ChecksumCRC32,CRC64NVME:ChecksumCRC64NVME}'
FULL_OBJECT covers the complete object. COMPOSITE combines checksums from its uploaded parts. Before comparing a stored value with your own, match the algorithm, checksum type, and encoding. AWS returns binary digest values encoded in Base64, while sha256sum prints hexadecimal. A composite SHA-256 cannot be compared directly with a whole-file SHA-256, even after converting the encoding. An empty field for one algorithm does not by itself indicate damage. See the Amazon S3 checksum types and the head-object reference.
In our negative test, a second write changed only the first byte. The latest download printed backup.bin: FAILED and the check exited with status 1. The service had returned exactly the newer file we requested. The manifest belonged to the earlier version.
Keep the failed copy and the original manifest. Check the endpoint, bucket, key, and recorded version ID before retrying. Where versioning is available, set VERSION_ID to the value recorded at upload and retrieve that version into a new file. This requires access to the specific version.
aws --endpoint-url "$ENDPOINT" s3api get-object \
--bucket "$BUCKET" --key "$KEY" --version-id "$VERSION_ID" \
restored/pinned.bin > restored/pinned-response.json
Give the pinned copy the filename the manifest expects in a fresh directory, then run the check again. This preserves the first download for comparison.
mkdir pinned-check
cp restored/pinned.bin pinned-check/backup.bin
(cd pinned-check && sha256sum --check ../expected/SHA256SUMS)
The pinned version passed in our test. If the expected version still fails, check whether you retrieved a byte range, compared a compressed archive with its expanded contents, or recorded the source while it was still changing. Retain the failed result until you can explain it. Even a matching digest only verifies the bytes. Open the archive or restore it into a disposable application to check that the backup itself is usable.
To try this with Object Storage with Hivenet, use the endpoint supplied for your test bucket and repeat the upload and download with one expendable backup. The measured results above come from Moto. Check versioning and optional checksum metadata on your own endpoint. For a migration involving many files, our rclone transfer verification guide covers how to extend the check across a batch.
Pick one AI, compute, or storage workload and see the difference for yourself. Spin it up in minutes, or let our team map your fastest path to production.