# The backup that succeeded without data

The local job reports a successful restic snapshot, but the expected data is
missing. Investigate the source and make the job fail when the source mount is
absent. A valid mounted backup must still succeed and be restorable.

## Environment

Use a disposable Linux environment with Bash, Python 3, restic and util-linux.
The kernel must allow unprivileged user and mount namespaces. The exercise
creates a local restic repository and synthetic data in `.lab-state`; do not
put real data there. The repository password is deliberately public and is
not suitable for real backups.

Bind mounts are made only inside a short-lived namespace, not on the host. No
systemd units, host mount configuration, monitoring service or cloud resources
are modified. The script models the backup step, not a systemd timer or
heartbeat monitor. No elevated host privileges are required.

## Investigate

```sh
./setup.sh
./lab.sh snapshots
./lab.sh contents
./lab.sh inspect
./lab.sh unmounted
```

Inspect `backup.sh`. Change that job so it refuses an unmounted source before
creating a snapshot, but still backs up the real synthetic data when mounted:

```sh
./lab.sh mounted
./verify.sh
./teardown.sh
```

Teardown deletes only this lab's `.lab-state` after checking its ownership
marker. It does not reset edits to `backup.sh`; re-extract the bundle to start
over.

The [opsbreakfix.com runbook and demo video](https://opsbreakfix.com/devops/monitor-a-restic-backup-from-a-systemd-timer/#see-it-run)
show the same empty-source failure with a systemd service and timer. The video
also covers monitoring cases outside this lab.
