ND-0018 / LINUX OPERATIONS
Restore a Backup Before You Need It
A completed backup job tells you it wrote something. Build a separate restore check that proves you can recover the data you need, from the artifact you actually have, in the time your service can tolerate. Define a passing result Pick a representative backup you are authorized to handle and an isolated restore target. Set […]
A completed backup job tells you it wrote something. Build a separate restore check that proves you can recover the data you need, from the artifact you actually have, in the time your service can tolerate.
Define a passing result
Pick a representative backup you are authorized to handle and an isolated restore target. Set the expected restore point, required files or records, and the service check you will use. Do not restore over a live path. For the exercise below, success is two files restored into an empty directory, with both checksums matching a separately held manifest.
Try it with two disposable files
Use a disposable Linux shell with GNU tar and Coreutils. This creates its own archive from harmless text. Do not extract an untrusted or unfamiliar archive with this recipe. Run as an unprivileged user in a test environment.
lab_dir=$(mktemp -d)
cd "$lab_dir" || exit 1
mkdir original restored
printf "mode=demo\n" > original/service.conf
printf "field-guide-ok\n" > original/health.txt
(cd original && sha256sum service.conf health.txt) > expected.sha256
tar -czf backup.tar.gz -C original service.conf health.txt
tar -tzf backup.tar.gz
tar -xzf backup.tar.gz -C restored
(cd restored && sha256sum -c ../expected.sha256)
Listing the members is useful for checking scope. Extraction proves the test archive was readable and the files could be written into the destination. The final check confirms the named files matched the manifest. In a real rehearsal, obtain the manifest through a trusted backup process and protect it independently of the archive. GNU tar extraction manual · GNU Coreutils reference
Prove that your check can fail
Add one line to the disposable restored health file and repeat the check:
printf "changed\n" >> restored/health.txt
(cd restored && sha256sum -c ../expected.sha256)
The health file should fail verification while the service config still passes. A test that keeps passing after you change a required file is not useful evidence. When done, leave the lab directory and delete it if you do not need the evidence.
Add an application check
In a real rehearsal, check ownership, permissions, encryption keys, backup age, and dependencies separately. Use an isolated service instance; prevent unintended contact with production, and verify a known read operation through its normal application interface. For a database, use the product’s supported restore procedure and verify consistency and representative records. Record what was actually recovered and how long the full process took.
What we verified
On Debian 13 with GNU tar 1.35 and Coreutils 9.7, both recovered files matched the manifest. Changing the restored health file caused only that file to fail. We did not restore a database, validate permissions or application health, or establish a recovery-time objective in this exercise.