Time a restore and measure it against an RTO and RPO
Task
Set an RTO and RPO for a small file service, back it up on a schedule, "lose" the data, and restore it with a stopwatch running from the moment of loss to the moment the service is verified working. Compare the measured recovery time and the age of the restored data with the targets, and record the gap.
Steps
- Record targets in
lab/recovery/targets.txtasrto_minutes: 15andrpo_minutes: 10. - Fill
/srv/fileswith 500 files, schedule the backup, and let it run at least twice. Keep writing a new timestamped file every minute. - Delete the contents of
/srv/filesand record the time inlab/recovery/log.csvwith headertime,eventasloss. - Restore from the latest backup, restart the share, and verify it from a client. Record
restore_started,restore_finishedandverifiedin the log. - Record in
lab/recovery/result.txtthe linesrto_actual_minutes:,rpo_actual_minutes:(loss time minus the time of the newest restored file) andmet:with yes or no for each target.
Verify
These checks run in a POSIX shell: Terminal on macOS or Linux, and on Windows Git Bash (it comes with Git for Windows) or WSL. A stock Windows PowerShell or Command Prompt has no awk or grep, so there the first line fails.
grep -Ec '^(rto|rpo)_minutes: [0-9]+' lab/recovery/targets.txt
awk -F, 'NR>1 {print $2}' lab/recovery/log.csv | paste -sd' ' -
grep -Ec '^(rto|rpo)_actual_minutes: [0-9.]+' lab/recovery/result.txt
grep -c '^met:' lab/recovery/result.txt
The log records loss, restore start, restore finish and verification in that order, and the result has both actual figures and a verdict. The RPO can never be better than the backup interval: with ten-minute backups, up to ten minutes of new files are lost, which the files written every minute make visible.
Notes
The measured time includes everything: noticing the loss, finding the backup, restoring and verifying. Most real recoveries overrun because of the steps around the restore, not the restore itself, which is why the clock starts at the loss.
This is an independent study companion for CompTIA Server+ SK0-005 and is not produced by or endorsed by CompTIA.