There’s an old saying in operations: a backup you haven’t restored is a hope, not a backup. Backup jobs can report success for months while writing empty files, skipping folders, or saving to a disc that’s already failing.
The fix is a restore drill: pick some real files, restore them somewhere safe, and check they match. It takes about fifteen minutes, and it’s the cheapest insurance in IT.
Here’s a simple way to do it, plus a small script that does the comparing for you.
The drill
Pick a real dataset. Choose something that matters, like last month’s project folder, a database dump, or the accounting export. Not a test file you made up.
Restore it to a scratch location. Never restore over live data. Use a separate folder or machine.
Compare the results. Check that files exist, open correctly, and match the originals.
Time it. How long did it take? This number is your real recovery time, and it’s usually longer than people assume.
Write it down. Date, what you restored, what you found, and who did it.
The script
For step 3, checking by eye doesn’t scale. This script picks random files from the original folder and checks that the restored copy exists and has an identical SHA-256 hash.
Save it as restore_check.sh:
bash
!/usr/bin/env bash
Usage: ./restore_check.sh SOURCE_DIR RESTORED_DIR [SAMPLE_SIZE]
Picks random files from SOURCE_DIR and checks the restored copy matches.
set -euo pipefail
SRC="${1:?source dir}"
DST="${2:?restored dir}"
N="${3:-5}"
pass=0; fail=0
while IFS= read -r -d '' file; do
rel="${file#"$SRC"/}"
if [[ ! -f "$DST/$rel" ]]; then
echo "MISSING $rel"; fail=$((fail+1)); continue
fi
a=$(sha256sum "$file" | cut -d' ' -f1)
b=$(sha256sum "$DST/$rel" | cut -d' ' -f1)
if [[ "$a" == "$b" ]]; then
echo "OK $rel"; pass=$((pass+1))
else
echo "DIFFERS $rel"; fail=$((fail+1))
fi
done < <(find "$SRC" -type f -print0 | shuf -z -n "$N")
echo; echo "Checked $((pass+fail)) file(s): $pass ok, $fail problem(s) "
[[ $fail -eq 0 ]]
Make it executable and run it:
bash
chmod +x restore_check.sh
./restore_check.sh /data/projects /tmp/restore-test 10
Here’s the output from a quick test I ran, with one file missing from the restore and one changed:
text
MISSING three.txt
DIFFERS bids/two.txt
OK bids/one.txt
Checked 3 file(s): 1 ok, 2 problem(s)
The script exits with a non-zero code if anything is wrong, so you can drop it into a scheduled job or CI step and get alerted.
What it doesn’t do
I’d rather be upfront about the limits:
It samples, so it can miss things. A random sample of ten files can’t prove the whole backup is good. Raise the sample size for important data, and also spot-check by opening a few files by hand.
It needs sha256sum and shuf. These come with GNU coreutils on Linux. On macOS you’ll want shasum -a 256 and gshuf (from brew install coreutils).
Files that legitimately change will differ. If the source is live, files edited after the backup will show as different. Compare against a snapshot or a quiet period when you can.
It can’t tell you the data is usable. A database file can match its hash and still be unusable if the app version has changed. For critical systems, open it in the real application.
It’s not a full backup validator. Backup tools often have their own verify commands. Use those too.
Turning it into a habit
Schedule it quarterly at minimum, and after any major change (new server, new backup tool, new storage).
Rotate what you test, so you cover different folders and systems over the year.
Follow 3-2-1: three copies, on two types of storage, with one off-site and isolated from your main network, since ransomware tends to hunt for connected backups.
Don’t assume SaaS is backed up. Many cloud tools protect their own platform, not your accidental deletions.
Write down recovery targets, such as how long you can be without email, accounting, or project files.
If you support non-technical teams
This is one of the easiest wins for small businesses, because nobody ever asks, “Have we tried restoring this?” I put together a plain-English guide on IT support for construction company job sites, laptops, and bid data that covers backups along with the rest of the basics if you need something to hand to a non-technical client or friend.
It’s from ZIA Networks, an IT services company in New Mexico. (Disclosure: I’m affiliated with them.)
Your turn
When did you last run a real restore, and what did you find? I’d like to hear your stories, especially the “backup was fine on paper” ones, in the comments.
Top comments (0)