Untested backups fail when you need them most. This guide establishes a verification routine that confirms your backups are actually restorable.
Verify Backup Integrity
# Restic
restic check --read-data
# BorgBackup
borg check --verify-data /backups/borg
# Verify tar archive
tar -tzf backup.tar.gz > /dev/null && echo "OK" || echo "CORRUPT"
Test Database Restore
mysql -u root -p -e "CREATE DATABASE restore_test;"
gunzip < latest-backup.sql.gz | mysql -u root -p restore_test
mysql -u root -p -e "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='restore_test';"
mysql -u root -p -e "DROP DATABASE restore_test;"
Test File Restore
mkdir /tmp/restore-test
restic restore latest --target /tmp/restore-test
ls -la /tmp/restore-test/var/www/html/wp-config.php
rm -rf /tmp/restore-test
Automate Verification
restic check 2>&1 | mail -s "Backup Verification - $(hostname)" [email protected]
Conclusion
Monthly backup tests should be standard practice. Our team performs regular backup verification as part of managed server support.
Comments