Build a Backup Verification Workflow for Hyper-V or Proxmox VMs with Scheduled Restore Checks
Build a backup verification workflow for Hyper-V or Proxmox so restores are tested before an outage forces the question.
Expected Outcome
A working backup verification workflow that schedules restore checks for Hyper-V or Proxmox VMs.
Assumptions
- Access to a Hyper-V or Proxmox environment
- Backup solution configured for VM backups
- Basic scripting knowledge (PowerShell for Hyper-V, Bash for Proxmox)
- Scheduled task management access (Task Scheduler for Windows, cron for Linux)
Bill of Materials
- Hyper-V or Proxmox server
- Backup software (e.g., Veeam, Acronis, built-in tools)
- Scripting tools (PowerShell, Bash)
- Email service for notifications (optional)
Build Steps
- Set Up Backup Verification Script
Create a script that will perform the restore check for your VMs.
Safe to run: read-only
# For Hyper-V Get-VM | ForEach-Object { Test-VMBackup -VM $_.Name -BackupLocation 'YourBackupLocation' } # For Proxmox for vmid in $(qm list | awk '{print $1}' | tail -n +2); do vzdump --dumpdir /path/to/backup --vmid $vmid --mode snapshot --storage YourStorage done - Schedule the Restore Check
Set up a scheduled task to run the backup verification script at regular intervals.
Changes system state: review before running
# For Hyper-V New-ScheduledTask -Action (New-ScheduledTaskAction -Execute 'PowerShell.exe' -Argument '-File C:\path\to\your\script.ps1') -Trigger (New-ScheduledTaskTrigger -Daily -At '02:00AM') -User 'SYSTEM' -RunLevel Highest | Register-ScheduledTask -TaskName 'Backup Verification' # For Proxmox echo '0 2 * * * /path/to/your/script.sh' | crontab -
- Set Up Notification System
Implement a notification system to alert you of the results of the backup verification.
Example pattern only. Adjust for your environment before running.
# For Hyper-V (using Send-MailMessage) if ($result -eq $true) { Send-MailMessage -To 'admin@example.com' -From 'backup@example.com' -Subject 'Backup Verification Successful' -Body 'All backups are valid.' -SmtpServer 'your.smtp.server' } else { Send-MailMessage -To 'admin@example.com' -From 'backup@example.com' -Subject 'Backup Verification Failed' -Body 'Some backups are invalid!' -SmtpServer 'your.smtp.server' } # For Proxmox (using mail command) if [ $result -eq 0 ]; then echo 'All backups are valid.' | mail -s 'Backup Verification Successful' admin@example.com else echo 'Some backups are invalid!' | mail -s 'Backup Verification Failed' admin@example.com fi - Record rollback evidence
Before treating the lab as complete, save the configuration files, commands, ports, credentials location, and restore notes needed to rebuild or back out the setup later.
Example pattern only. Adjust for your environment before running.
mkdir -p ./lab-notes date > ./lab-notes/build-review.txt printf '%s ' 'Record service URLs, ports, config paths, backup locations, and rollback notes here.' >> ./lab-notes/build-review.txt
- Run a non-production restore proof
Use a disposable VM, isolated network, or sandbox datastore to prove that at least one backup can restore without touching production workloads.
Example pattern only. Adjust for your environment before running.
# Hyper-V example: restore into an isolated test location using your backup product's documented restore command or console workflow. # Proxmox example: restore a test VMID into an isolated bridge or lab node before trusting the schedule. printf '%s ' 'Record restored VM name, backup timestamp, network isolation, and boot result.' >> ./lab-notes/build-review.txt
Validation
- Verify that the scheduled task runs successfully without errors.
- Check email notifications for both successful and failed backup verifications.
- Manually perform a restore from a backup to ensure the process works as expected.
Troubleshooting
- Check the backup product job history and hypervisor task log before changing the schedule.
- Confirm the restore target has enough capacity and that test restores are isolated from production networks.
Cleanup or Rollback
- Remove disposable restored VMs after recording the restore result.
- Keep the verification script, schedule definition, and restore notes in the backup runbook before deleting any test artifacts.
Next Improvements
- Consider implementing snapshot verification to ensure that the snapshots are not corrupted.
- Set up backup freshness reporting to track the age of backups and ensure they are up-to-date.
- Regularly review and update the backup verification script to accommodate any changes in your environment.