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.
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/, and/root/rest/inc/src/app/new.pymust exist. - 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) - Create
/root/rest/report.txtwith the following 5 lines.RESTORED_FILES=<2번 복원본의 파일 수>/SELECTIVE=1/STRIPPED_OK=yes/INCREMENTAL_OK=yes/RTO_MET=<7번의 판정>(The placeholders stand for the seconds elapsed, the number of files in the step 2 restore, and the verdict from step 7.)
Notes
- A selective restore is
tar -xzf <아카이브> -C <대상> <아카이브 안 경로>(the placeholders are the archive, the target, and the path inside the archive). Check the path first withtar -tzf. - Run the incremental restore in order, in the form
tar --listed-incremental=/dev/null -xzf <아카이브> -C <대상>(the placeholders are the archive and the target). - Time measurement is
S=$(date +%s); ...; E=$(date +%s); echo $((E-S)). - 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.
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/, and /root/rest/inc/src/app/new.py must exist.
You must extract the full backup first, then the incrementals in order. 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.
Rehearsal report
Create /root/rest/report.txt with the following 5 lines.
RESTORED_FILES=<2번 복원본의 파일 수> / SELECTIVE=1 / STRIPPED_OK=yes / INCREMENTAL_OK=yes / RTO_MET=<7번의 판정>
Gather the actual results of the earlier steps. The number of mismatches comes from the comparison result.