Skip to main content

Checking an Object Store End to End

StorONE shows that an object store is configured, but not that it's storing data correctly. The only S3 check StorONE runs itself is when a store is first created: it lists the buckets, creates an empty test bucket, and deletes it again. It never writes an object, and it doesn't run again after a failover, a restart, or an upgrade.

So a store can accept connections, list buckets, and still fail uploads. The checks on this page write real data, read it back, and compare checksums. Run them:

  • after creating a store, before you hand it over to an application;
  • after a failover, a node restart, or a system upgrade;
  • after growing a store;
  • when an application reports S3 errors but the store looks healthy (see Troubleshooting).

Before you start

  • Use a host with the AWS CLI set up as in Connecting an S3 client, and sha256sum.

  • Create a bucket just for these checks, once, with an Admin key:

    aws $EP s3 mb s3://s1-healthcheck
    

    Don't turn on versioning or Object Lock for it. On a versioned bucket a delete only adds a delete marker, so the last step of the check wouldn't free the space.

  • Any key granted to the store can then run the checks, Regular keys included.

Quick write-read-delete check

The check writes a small object and a 16 MB object (the AWS CLI uploads files of that size in parts, so multipart uploads are tested too), reads both back, compares the SHA-256 checksums, and deletes them.

EP="--endpoint-url https://10.0.0.50:9000 --no-verify-ssl"
B=s1-healthcheck
P="check/$(date +%Y%m%d-%H%M%S)"

head -c 4K  /dev/urandom > small.bin
head -c 16M /dev/urandom > large.bin

for f in small.bin large.bin; do
  aws $EP s3 cp "$f" "s3://$B/$P/$f"            || { echo "UPLOAD FAILED: $f"; break; }
  aws $EP s3 cp "s3://$B/$P/$f" "$f.back"       || { echo "DOWNLOAD FAILED: $f"; break; }
  if [ "$(sha256sum < "$f")" = "$(sha256sum < "$f.back")" ]; then
    echo "OK: $f"
  else
    echo "CHECKSUM MISMATCH: $f"
  fi
  aws $EP s3 rm "s3://$B/$P/$f"                 || echo "DELETE FAILED: $f"
done

aws $EP s3 ls "s3://$B/$P/"                     # should list nothing
rm -f small.bin large.bin small.bin.back large.bin.back

A healthy store prints OK for both files, and the last listing is empty. Any FAILED or MISMATCH line, or an InternalError from the AWS CLI, means the store isn't working properly even if clients can connect. See Troubleshooting.

Checking data before and after maintenance

The quick check proves the store works now. To prove that data written before a failover or upgrade is still there and intact, write a few known objects before the maintenance and compare them afterwards.

Before the maintenance. Write the objects and keep their checksums on the client host:

mkdir -p canary
for i in 1 2 3; do head -c 8M /dev/urandom > canary/obj$i.bin; done
(cd canary && sha256sum obj*.bin > ../canary.sha256)
aws $EP s3 cp canary/ "s3://$B/canary/" --recursive
rm -rf canary

After the maintenance. Download them and check them against the saved checksums:

aws $EP s3 cp "s3://$B/canary/" canary/ --recursive
(cd canary && sha256sum -c ../canary.sha256)

Each file should report OK. Then run the quick check as well, to confirm that new writes work too. When you no longer need the objects, delete them with aws $EP s3 rm "s3://$B/canary/" --recursive.

After a failover or upgrade

  1. Confirm that the store is still listed, with the same floating IP and port:

    applications objects stores list --application=<name> --volume=<name>
    
  2. Connect a client to the store's usual endpoint. The address doesn't change on failover (see High availability).

  3. Run the before-and-after check, if you wrote objects beforehand, then the quick check.

  4. Check that the applications using the store have reconnected, and look at their logs for failed requests during the switch-over.

Checking that Object Lock is enforced

Before you rely on Object Lock for immutable backups, check that the store really refuses to delete locked versions. Use a separate test bucket and an Admin key, and Governance mode only: a Compliance-mode test object can't be removed until its date, and neither can its bucket.

B=lock-test
aws $EP s3api create-bucket --bucket $B --object-lock-enabled-for-bucket
echo test > lock-test.txt
UNTIL=$(date -u -d '+1 day' +%Y-%m-%dT%H:%M:%SZ)

# 1. Retention: a locked version can't be deleted without bypass
V1=$(aws $EP s3api put-object --bucket $B --key retained.txt --body lock-test.txt \
       --object-lock-mode GOVERNANCE --object-lock-retain-until-date "$UNTIL" \
       --query VersionId --output text)
aws $EP s3api get-object-retention --bucket $B --key retained.txt --version-id "$V1"   # GOVERNANCE and the date
aws $EP s3api delete-object --bucket $B --key retained.txt --version-id "$V1"          # expect AccessDenied
aws $EP s3api delete-object --bucket $B --key retained.txt --version-id "$V1" \
    --bypass-governance-retention                                                      # expect success

# 2. Legal hold: blocks deletion even with Governance bypass
V2=$(aws $EP s3api put-object --bucket $B --key held.txt --body lock-test.txt \
       --query VersionId --output text)
aws $EP s3api put-object-legal-hold --bucket $B --key held.txt --version-id "$V2" --legal-hold Status=ON
aws $EP s3api delete-object --bucket $B --key held.txt --version-id "$V2" \
    --bypass-governance-retention                                                      # expect AccessDenied
aws $EP s3api put-object-legal-hold --bucket $B --key held.txt --version-id "$V2" --legal-hold Status=OFF
aws $EP s3api delete-object --bucket $B --key held.txt --version-id "$V2"              # expect success

# Clean up
aws $EP s3api delete-bucket --bucket $B
rm -f lock-test.txt

If a delete marked "expect AccessDenied" succeeds, retention isn't being enforced: stop and contact StorONE support before you store data that must be immutable.

To check the bucket your application actually uses, read the retention of one of its recent versions with get-object-retention, and confirm that the mode and retain-until date match your policy.


Next: Monitoring object stores