Back to lessons

Hosting Operations

Extract a Backup Into a Restore Sandbox

You need to extract a backup into a dedicated restore-sandbox directory and list the restored files.

Command

cd restore-dr && rm -rf restore-sandbox/full && mkdir -p restore-sandbox/full && tar -xf backups/2026-06-25/site.tar -C restore-sandbox/full

What changed

The archive is extracted only under restore-dr/restore-sandbox/full.

Danger

caution

When to use it

Use for restore drills where writing into an isolated sandbox is intentional.

When not to use it

Do not run extraction into /, /var/www, or a live application directory during a drill.

Undo or recovery

Remove the restore-dr/restore-sandbox/full directory from the fixture copy.

Expected output

A restored file list under restore-sandbox/full.

demo script

Disposable terminal steps

  1. cd restore-dr && rm -rf restore-sandbox/full && mkdir -p restore-sandbox/full && tar -xf backups/2026-06-25/site.tar -C restore-sandbox/full
  2. cd restore-dr && find restore-sandbox/full -type f | sed 's#^restore-sandbox/full/##' | sort

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ cd restore-dr && rm -rf restore-sandbox/full && mkdir -p restore-sandbox/full && tar -xf backups/2026-06-25/site.tar -C restore-sandbox/full
::exit-code::0
$ cd restore-dr && find restore-sandbox/full -type f | sed 's#^restore-sandbox/full/##' | sort
CHECKSUMS.sha256
app/config.yml
app/orders.csv
app/secrets.env
bin/deploy.sh
public/index.html
uploads/avatar.txt
::exit-code::0

YouTube Short

Restore into a sandbox.

For drills, extract the archive into a sandbox path. Then validate the restored tree before touching production.

LinkedIn hook

A restore drill should write to a sandbox, not production.

Question: Do your restore drills ever write outside a sandbox?

experiments

A/B tests to run

Metric: comment_rate

A: Restore drills belong in a sandbox.

B: Never test restores into production first.