The short answer
Restore the backup onto a spare server, check files, database and an application login, note how long it took, write down the steps and repeat every month or after big changes.
Use a spare place, not the live server
Start a small temporary server, or a virtual machine on your own computer. Never test by restoring over the live site.
Restore the files
sudo mkdir -p /restore-test
sudo rsync -a /path/to/backup/site/ /restore-test/
sudo find /restore-test -type f | wc -lCompare the number of files and the total size with the original. For important files, compare checksums with sha256sum.
Restore the database
mysql -e "CREATE DATABASE restore_test"
mysql restore_test < backup.sql
mysql restore_test -e "SHOW TABLES;" | wc -lCheck that the tables are there, and look at the row counts of the main tables. A dump that stopped half way often imports with no error.
Start the application and log in
Point a test domain or a hosts-file entry at the restored copy. Log in, open a page, place a test order or save a record. The application must work, not only the files exist.
Time it and write it down
- How long did the restore take? That is the real downtime you should expect.
- What steps did you need, and what did you have to look up? Write them as a checklist.
- Where are the passwords and encryption keys? A backup you cannot decrypt is useless.
Make it a habit
- Test every month, and after changes to the server or the backup tool.
- Keep at least one copy off the server and in a different place.
- Alert when a backup fails or becomes much smaller than before.
Questions people ask
How often should I test a restore?
Monthly is a good habit, and always after you change the backup setup.
Is a snapshot a backup?
A snapshot on the same storage is not enough. Keep a copy somewhere else too.
What if the test fails?
That is the point of the test. Fix the backup now and test again.