Skip to content

nasbackup.sh: verify backup integrity with qemu-img check#12845

Open
jmsperu wants to merge 1 commit intoapache:4.20from
jmsperu:fix/nasbackup-verify
Open

nasbackup.sh: verify backup integrity with qemu-img check#12845
jmsperu wants to merge 1 commit intoapache:4.20from
jmsperu:fix/nasbackup-verify

Conversation

@jmsperu
Copy link

@jmsperu jmsperu commented Mar 17, 2026

Summary

  • Add verify_backup() function that runs qemu-img check on all qcow2 backup files after backup completes
  • Catches corrupt or truncated backup files (e.g. from NFS I/O errors, storage full, or interrupted writes) before reporting success to CloudStack
  • Applied to both running VM (push backup) and stopped VM (qemu-img convert) backup paths

Motivation

Without verification, a backup that was silently corrupted by NFS errors or disk full conditions is reported as successful. The admin only discovers the corruption when attempting to restore — which is the worst possible time. qemu-img check is fast (reads metadata only, not full data) and catches structural corruption.

Test plan

  • Backup running VM — verify qemu-img check passes in agent log
  • Backup stopped VM — verify check passes
  • Manually corrupt a qcow2 file and run verify — confirm it catches the corruption and exits non-zero

Add verify_backup() that runs qemu-img check on all qcow2 files
after backup completes. Catches corrupt or truncated backup files
(e.g. from NFS I/O errors or storage full) before reporting success.

Applied to both running and stopped VM backup paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant