CKA — Verify Backup

less than 1 minute read

Verify Backup Integrity

After taking a backup, always verify it is valid and not corrupted.

Snapshot Status

ETCDCTL_API=3 etcdctl snapshot status /opt/etcd-backup.db --write-out=table

Output:

+---------+----------+------------+------------+
|  HASH   | REVISION | TOTAL KEYS | TOTAL SIZE |
+---------+----------+------------+------------+
| abc1234 |    45678 |       1242 |     3.1 MB |
+---------+----------+------------+------------+
Field Meaning
HASH Integrity checksum — verifies data is not corrupted
REVISION etcd revision number at time of backup
TOTAL KEYS Number of key-value pairs in the backup
TOTAL SIZE Size of the backup file

Note: The snapshot status command reads the local file. No TLS certificates are required.

JSON Output

ETCDCTL_API=3 etcdctl snapshot status /opt/etcd-backup.db --write-out=json

Verify File Exists and Has Content

ls -lh /opt/etcd-backup.db
# Should show a file size > 0 (typically several MB)

file /opt/etcd-backup.db
# Should identify it as a data file

Test Restore in Isolated Environment

For production systems, test the restore process in an isolated environment:

# Restore to a temporary directory
ETCDCTL_API=3 etcdctl snapshot restore /opt/etcd-backup.db \
  --data-dir=/tmp/etcd-test-restore

# Verify the directory was created with data
ls -la /tmp/etcd-test-restore/member/

# Clean up
rm -rf /tmp/etcd-test-restore

Next: etcd Best Practices ->

Updated: