DataOps Observer
← All labs

Backup integrity / Intermediate / 25–40 min

The backup that hid a partial snapshot

A real restic backup cannot read one synthetic file, but its wrapper reports success. Correct the failure handling and verify a complete restore.

LAB IDdataops-04-restic-partial-backupTRACK / dataops.observer
Engineer monitoring a data pipeline beside storage servers

The scenario

A backup job reports success even though restic created a partial snapshot with an unreadable file. Investigate the exit status and source permissions, then restore a complete snapshot to a clean directory.

Mission objectives

  • Reproduce the partial snapshot and compare the wrapper with restic's exit status.
  • Make the job fail for any nonzero restic exit and repair access to the lab file.
  • Restore a fresh snapshot and verify both synthetic files and repository data.

Lab README

The backup that hid a partial snapshot

A backup wrapper prints success, but one synthetic file is missing from the snapshot. Investigate restic's real exit status, correct the wrapper, and restore a complete snapshot without raising backup privileges.

Before you begin

Use a disposable Linux environment with Bash, Python 3, restic and util-linux (unshare and setpriv). Unprivileged user namespaces must be enabled. Work on a private Linux filesystem with normal Unix permissions; shared or mounted filesystems that ignore permission bits are unsuitable.

The lab creates a local restic repository and synthetic files in .lab-state. The fixed repository password is public and not suitable for real backups. Never put real data there. The backup runs in a user namespace with DAC override and read-search capabilities removed, so the unreadable file remains unreadable even when the lab is launched by root. No host mounts or system permissions are changed.

Investigate

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

Compare the wrapper's success message with the actual restic status, then inspect backup.sh and the synthetic file permissions. Make the wrapper return a nonzero exit for every failed restic run, including a partial backup, and allow the lab user to read the file. Do not change the synthetic file contents or run with extra privileges.

./lab.sh backup
./verify.sh
./teardown.sh

Verification creates an additional partial snapshot while checking failure handling, checks a wrong-password failure, then creates a complete snapshot. It also tests how the wrapper handles simulated nonzero exit statuses. It restores that snapshot into a new temporary directory, compares both files, and runs restic check --read-data. Teardown removes the lab repository and synthetic data after checking the state marker and host mounts; configuration edits remain. Re-extract the archive to reset the exercise.

The related restore runbook and demo show a real partial restic backup and restore check. The lab uses an isolated namespace to make the permission failure reproducible.

View Markdown source ↗

Get the lab

Download and inspect the installer before running it. It checks the archive's SHA-256 digest and refuses to overwrite an existing lab directory.

curl -fsSLO https://devops.download/labs/dataops-04-restic-partial-backup.sh
less dataops-04-restic-partial-backup.sh
bash dataops-04-restic-partial-backup.sh
cd labs/dataops-04-restic-partial-backup
./setup.sh

When you've made your changes, run ./verify.sh. Remove lab resources with ./teardown.sh.

Download the archive instead ↗

Need a nudge?

Hint #1

restic can create a snapshot even when it cannot read every source file; inspect its actual exit status.

Hint #2

Check how backup.sh handles nonzero statuses and why the lab file cannot be read. Avoid running the backup with extra privileges.

Hint #3 · Related guide on opsbreakfix.com

Read the related guide ↗

Solved it?

Explore the related guide on opsbreakfix.com.

Continue to opsbreakfix.com ↗