Restore Rehearsal
Goal
Carry out a recovery rehearsal with the backup set you built earlier, and measure the time to determine whether the RTO is met.
Why it matters
Recovery is all about order and verification. Extracting directly with -C / without going through a temporary path is an irreversible operation, and breaking the incremental restore order makes files that should exist disappear. And the RTO is a wish until you actually measure it — the number one reason RTO is missed in practice is not slow extraction but failing to count the time to bring the backup over.
The recovery objectives for this lab are RPO 24 hours and RTO 300 seconds.
The final incident is a restore where "the data is the same down to the byte, but the services will not start". A hash comparison vouches only for content, and who can open the file with what permissions is decided by the mapping between owner numbers and names, the permission bits, and extended permissions (ACLs). Whichever of the three is off, it looks like the same Permission denied, and the ways to fix the three differ.
Steps
- Create the
/root/restdirectory, and write the following two lines to/root/rest/objective.txt.RPO=24h/RTO=300s - Restore
/root/bk/full.tar.gzto/root/rest/check/. You must not touch the current/root/bk/src. - Compare the restored copy with the original recursively and save the result to
/root/rest/diff.txt. (There may be differences because of the file you added in step 4, so you may limit the comparison to theconfanddatadirectories.) - Restore only
src/app/conf.yamlfrom the archive to/root/rest/one/. There must be no other files in that directory. - Use
--strip-componentsto removesrc/from the archive and restore to/root/rest/stripped/. As a result,/root/rest/stripped/app/main.pymust exist. - Restore the incremental set in order. Extract full → inc0 → inc1, in that order, into
/root/rest/inc/; the result must be exactly the point of the last incremental:/root/rest/inc/src/app/new.pypresent, andsrc/logs/old.log, deleted just before inc1, absent. - Perform the full recovery from step 2 through step 6 once more, timing it, and write the following two lines to
/root/rest/timing.txt.ELAPSED=<초>/MEETS_RTO=<yes|no>(yes if within 300 seconds) - Incident: raise
incident bk-app-down, work out per service why all three services fail to start with Permission denied after the old server's backup was extracted on a new server, then, without widening permissions, restore the same owners, modes, and extended permissions as on the old server. The report is/root/incident/bk-app-down/report.txt(candidate codes are in the step description).
Notes
- For a selective restore, give the path inside the archive as the argument exactly. List the contents first to check that path: if even one character differs, you get "Not found in archive".
- Extract incrementals in incremental mode, into an empty directory, in the order they were made. The snapshot file is neither read nor written then.
- Measure time by subtracting the start time from the end time (in seconds). Compute the verdict rather than writing it by hand.
- The archive records owners as both a name and a number. An option decides which one extraction follows, and on a new server the same name may have a different number.
- Common mistake 1: in step 2, if you do not create the target directory beforehand, tar fails.
- Common mistake 2: in step 6, if you reverse the incremental order, later changes are overwritten by earlier ones and files disappear.
- Incident tools:
incident listshows the list, andincident show <이름>(name) shows the ticket (a colleague's report) again. Raising the same incident again returns it to its original broken state. - Write the report to
/root/incident/<이름>/report.txt(name is the incident name): one line<이름>: <원인 코드>(name: cause code) per target, plusevidence: <관찰한 출력 한 줄>(one line of output you observed). The evidence line is checked against the output actually seen in the incident. - Grading does not look only at the report. The actual state of what you restored, such as hashes, ownership, and modes, must be right, and workarounds that only erase the symptom fail.
Record the recovery objectives
Create the /root/rest directory, and write the following two lines to /root/rest/objective.txt.
RPO=24h / RTO=300s
The RPO and RTO are given in this lab. Write the values exactly.
Restore to a temporary path
Restore /root/bk/full.tar.gz to /root/rest/check/. You must not touch the current /root/bk/src.
Never extract directly into the current location. Use the option that specifies the restore location.
Compare with the original
Compare the restored copy with the original recursively and save the result to /root/rest/diff.txt. (There may be differences because of the file you added in step 4, so you may limit the comparison to the conf and data directories.)
There is a command that compares whole directories recursively. If there are no differences, it is silent.
Selective restore
Restore only src/app/conf.yaml from the archive to /root/rest/one/. There must be no other files in that directory.
If you pass the path inside the archive as an argument, only that is extracted. First confirm the exact path from the listing.
Restore with path adjustment
Use --strip-components to remove src/ from the archive and restore to /root/rest/stripped/. As a result, /root/rest/stripped/app/main.py must exist.
There is an option that specifies how many leading path elements to strip.
Restore in incremental order
Restore the incremental set in order. Extract full → inc0 → inc1, in that order, into /root/rest/inc/; the result must be exactly the point of the last incremental: /root/rest/inc/src/app/new.py present, and src/logs/old.log, deleted just before inc1, absent (the grader extracts the chain again from the same set and compares).
You must extract the full backup first, then the incrementals in order. If you extract an incremental like an ordinary archive, additions come in but deletions are not applied. Do not update the snapshot file during a restore.
Measure the recovery time
Perform the full recovery from step 2 through step 6 once more, timing it, and write the following two lines to /root/rest/timing.txt.
ELAPSED=<초> / MEETS_RTO=<yes|no> (yes if within 300 seconds)
Compute the difference between the start and end times in seconds. Compare it with the objective to reach a verdict.
Incident: the restore is supposedly finished, but three services fail with Permission denied
Running incident bk-app-down raises the incident. Symptom: the old server (app01)'s backup /backup/bkapp/bkapp-1104.tar.gz was extracted to /srv/bkapp on the new server, but all three services, bkapp-web, bkapp-worker, and bkapp-report, fail to start with Permission denied (startup check bkappctl, logs in /var/log/bkapp/). Find the cause for each service and fix it so that each of the three services starts under its own account. The end state is the same owners (by name), modes, and extended permissions (ACLs) as on the old server, with the content unchanged. Starting them by widening permissions (777, o+r), changing the accounts' numbers or group memberships, or running the services as root is a failure. In /root/incident/bk-app-down/report.txt, write three lines, bkapp-web: <코드>, bkapp-worker: <코드>, and bkapp-report: <코드> (code), plus evidence: <관찰한 출력 한 줄> (one line of output you observed). Each service's code is one of the following: acl-lost (extended permissions were not restored), mode-lost (permission bits were trimmed), numeric-owner (owners were carried over by number and became other accounts), wrong-group (the account is missing a group membership).
Direction: root is not blocked by permission bits, so reproduce as the service account. Even with the same Permission denied, which of the three layers (owner, permission bits, extended permissions/ACLs) blocked it may differ per service. Tools: runuser -u --, ls -ln and ls -l, stat, getent and id, getfacl, tar -tv (with and without --numeric-owner). Concretely: look at the file owners both by number and by name and compare them with this server's account numbers. Compare the modes recorded in the archive with the current modes, and also look at the permission list the old server left alongside the backup (/backup/bkapp). The data is already the same, so what you must fix is the metadata.