The verify command validates the integrity of an APACK archive by checking its structure and data checksums.
apack verify [OPTIONS] <archive>
apack v [OPTIONS] <archive>
Arguments:
<archive>- Path to the archive file to verify
| Option | Description | Default |
|---|---|---|
-v, --verbose |
Show details for each entry | false |
--quick |
Quick check (headers only) | false |
Reads all data and verifies checksums:
apack verify archive.apackWhat it checks:
- File header validity
- Entry header structure
- Chunk header integrity
- Data checksums (reads all data)
- Decompression validity
- Trailer structure
Detects:
- Checksum mismatches
- Corrupted compressed data
- Truncated entries
- Invalid chunk sequences
- Format violations
Validates headers without reading data:
apack verify --quick archive.apackWhat it checks:
- File header validity
- Entry header structure
- Entry metadata
- Trailer structure
Does NOT check:
- Data checksums
- Chunk data integrity
- Decompression validity
Use when:
- Time is critical
- Checking for structural issues only
- Initial quick scan before full verification
# Full verification
apack verify archive.apackOutput (success):
Verifying: archive.apack
OK - 42 entries verified (15.2 MB)
Output (failure):
Verifying: corrupted.apack
FAIL: data/file.bin - Checksum mismatch
FAILED - 1 of 42 entries failed verification
apack verify -v archive.apackOutput:
Verifying: archive.apack
Format version: 1.0.0
Entries: 42
Chunk size: 256 KB
Random access: yes
Encrypted: no
OK: config.json (1.5 KB)
OK: src/main.java (2.3 KB)
OK: src/util/Helper.java (1.1 KB)
OK: assets/logo.png (45.2 KB)
OK: README.md (512 B)
OK - 5 entries verified (50.6 KB)
apack verify --quick archive.apackOutput:
Verifying: archive.apack
OK - 42 entries verified
Note: Quick mode doesn't show data size since data isn't read.
| Code | Meaning | Description |
|---|---|---|
0 |
Success | All entries verified |
1 |
Verification Failed | One or more entries failed |
2 |
Archive Error | Could not read archive |
#!/bin/bash
if apack verify archive.apack; then
echo "Archive is valid"
else
echo "Archive verification failed"
exit 1
fi# Check exit code explicitly
apack verify archive.apack
case $? in
0) echo "Valid" ;;
1) echo "Corrupted" ;;
2) echo "Cannot read archive" ;;
esacFAIL: data/file.bin - Checksum mismatch
Cause: Data corruption in storage or transmission.
Solution:
- Restore from backup
- Re-download if transferred
- Check storage medium
FAIL: data/compressed.bin - Decompression failed
Cause: Corrupted compressed data.
Solution:
- Data is likely unrecoverable
- Restore from backup
- If ECC enabled, try recovery
FAIL: large/file.bin - Unexpected end of data
Cause: Archive file is truncated.
Solution:
- Check for incomplete copy
- Verify disk space during creation
- Re-create archive
Error reading archive: Invalid entry header
Cause: Structural corruption.
Solution:
- Archive may be severely damaged
- Restore from backup
Format version: 1.0.0 # Format version
Entries: 42 # Total entry count
Chunk size: 256 KB # Chunk size setting
Random access: yes # TOC present
Encrypted: no # Encryption status
OK: filename.txt (1.5 KB) # Entry verified
FAIL: broken.bin - Error msg # Entry failed
OK - 42 entries verified (15.2 MB) # All passed
FAILED - 1 of 42 entries failed # Some failed
#!/bin/bash
# Verify backups after creation
backup_dir="/backups"
for archive in "$backup_dir"/*.apack; do
echo "Verifying: $archive"
if apack verify "$archive"; then
echo "OK"
else
echo "FAILED: $archive" >> /var/log/backup-errors.log
fi
done# After copying or downloading
scp server:/data/archive.apack ./
if apack verify archive.apack; then
echo "Transfer successful"
else
echo "Transfer corrupted, retrying..."
scp server:/data/archive.apack ./
fi# Verify before extracting
if apack verify archive.apack; then
apack extract archive.apack -o ./output/
else
echo "Archive is corrupted, cannot extract"
exit 1
fi#!/bin/bash
# Weekly archive verification
find /archives -name "*.apack" -print0 | while IFS= read -r -d '' archive; do
if ! apack verify --quick "$archive" 2>/dev/null; then
echo "$(date): Verification failed: $archive" >> /var/log/archive-health.log
fi
done# GitHub Actions example
steps:
- name: Create Archive
run: apack create build.apack ./dist/
- name: Verify Archive
run: apack verify build.apack
- name: Upload if Valid
if: success()
run: upload-to-storage build.apackThe verify command automatically detects compression:
- Scans entries for compression algorithm ID
- Loads appropriate decompression provider
- Decompresses and verifies each chunk
Note: Verification of encrypted archives requires the decryption key. Use the extract command with password for encrypted archive verification.
- Reads all data from disk
- CPU usage for decompression
- Time proportional to archive size
- Recommended for critical verification
- Reads only headers
- Minimal I/O and CPU
- Very fast for large archives
- Good for initial checks
| Archive Size | Recommendation |
|---|---|
| < 100 MB | Always use full verification |
| 100 MB - 1 GB | Full for important archives |
| > 1 GB | Quick first, full for backups |
| Error | Cause | Solution |
|---|---|---|
| "Archive not found" | File doesn't exist | Check the path |
| "Error reading archive" | Format/I/O error | Archive may be corrupted |
| "Unknown compression" | Missing provider | Install compression module |
# Use global verbose flag for stack traces
apack -v verify archive.apackThis shows full exception details for diagnosis.
Previous: Info Command | Back to: CLI Overview