btrfs-backup-ng-verify - Man Page
verify backup integrity
Synopsis
btrfs-backup-ng verify [Options] LOCATION
Description
Verify that backups at a given location are valid and restorable. This command provides multiple levels of verification to check backup integrity, from quick metadata checks to full restore tests.
Verification works with both local backup directories and remote SSH locations.
Arguments
- LOCATION
Backup location to verify. Can be a local path (e.g., /mnt/backup/home) or an SSH URL (e.g., ssh://user@host:/path/to/backup).
Options
- --level LEVEL
Verification level. Default: metadata. Valid levels:
- metadata
Quick check of snapshot existence and parent chain integrity. Verifies that all snapshots exist and that incremental chains are complete (no missing parent snapshots). This is fast and non-destructive.
- stream
Verify that btrfs send stream can be generated. Uses btrfs send --no-data to test stream generation without transferring actual file data. This validates that snapshot metadata is intact.
- full
Complete restore test to a temporary location. Actually restores snapshot(s) and verifies the restored subvolume is valid. This is the most thorough check but also the slowest. Requires --temp-dir for remote backups.
- --snapshot NAME
Verify only the specified snapshot instead of all snapshots.
- --temp-dir PATH
Temporary directory for full verification. Must be on a btrfs filesystem. Required for full verification of remote backups.
- --no-cleanup
Do not delete restored snapshots after full verification. Useful for inspection or debugging.
- --prefix PREFIX
Only verify snapshots matching the given prefix.
- --ssh-sudo
Use sudo for btrfs commands on remote host.
- --ssh-key FILE
SSH private key file for authentication.
- --fs-checks MODE
Filesystem verification mode. Valid values:
- auto
(Default) Warn about issues but continue operation.
- strict
Error out on filesystem check failures.
- skip
Bypass all filesystem verification checks.
- --no-fs-checks
Skip btrfs subvolume verification checks. Alias for --fs-checks=skip. Useful when verifying backup directories which are regular directories, not subvolumes.
- --json
Output results in JSON format for scripting and automation.
- -q, ā--quiet
Suppress progress output.
Verification Levels
Metadata (Fast)
Checks performed:
- Snapshot existence at backup location
- Parent chain completeness (no missing incremental parents)
- Optional comparison with source to find missing backups
This level is suitable for routine checks and can verify hundreds of snapshots in seconds.
Stream (Medium)
In addition to metadata checks:
- Generates btrfs send stream with --no-data flag
- Validates stream header and metadata integrity
- Does not transfer actual file data
This level catches corruption in snapshot metadata that metadata-only checks might miss.
Full (Thorough)
Performs actual restore:
- Restores snapshot to temporary location
- Verifies restored path is a valid btrfs subvolume
- Tests the complete restore pipeline
- Cleans up after verification (unless --no-cleanup)
This is the definitive test that a backup can be restored.
Exit Status
- 0
All verifications passed.
- 1
One or more verifications failed.
- 2
Error during verification (could not complete).
Examples
- Quick metadata check of local backup:
btrfs-backup-ng verify /mnt/backup/home
- Verify remote backup over SSH:
btrfs-backup-ng verify ssh://backup@server:/backups/home --ssh-sudo
- Stream integrity check:
btrfs-backup-ng verify /mnt/backup/home --level stream
- Full restore test:
btrfs-backup-ng verify /mnt/backup/home --level full --temp-dir /mnt/test
- Full verification of remote backup:
btrfs-backup-ng verify ssh://server:/backups/home --level full --temp-dir /mnt/test
- Verify specific snapshot:
btrfs-backup-ng verify /mnt/backup/home --snapshot home-20260104-120000
- JSON output for automation:
btrfs-backup-ng verify /mnt/backup/home --json
Output
The verify command displays a table of results showing:
- Snapshot name
- Pass/Fail status
- Details (parent snapshot, error messages)
Summary shows total passed, failed, and duration.
With --json, output is a JSON object containing:
- level: Verification level used
- location: Backup location
- duration_seconds: Total verification time
- summary: Counts of passed, failed, total
- results: Array of individual snapshot results
- errors: Array of error messages
Automation
For automated backup verification in scripts or cron:
#!/bin/bash
if ! btrfs-backup-ng verify /mnt/backup/home --json > /tmp/verify.json; then
# Send alert on failure
cat /tmp/verify.json | mail -s "Backup verification failed" admin@example.com
fiSee Also
btrfs-backup-ng(1), btrfs-backup-ng-restore(1), btrfs-send(8)
Referenced By
btrfs-backup-ng(1), btrfs-backup-ng-doctor(1).