Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add verify command #709

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add verify command #709

wants to merge 1 commit into from

Conversation

jonmchan
Copy link

Disclaimer - I probably wouldn't merge this code as is, but leaving it out there for reference in case anyone else wants it. I haven't written golang in years and the code is quite hacky.

I added a verify command that downloads all the chunks and verifies the SHA256 checksum.

Implementation wise, I cloned the receive command ripping out the zfs receive portion leaving only the SHA256 checksum checks. I added some messaging to show the results. It takes the same parameters as receive basically minus the destination dataset.

Example output:

success:

2024/12/19 19:31:08 spool/storage|backup_20241219193059.zstream.gz.pgp.vol1 - passed checksum!
2024/12/19 19:31:08 spool/storage|backup_20241219193059.zstream.gz.pgp.vol4 - passed checksum!
2024/12/19 19:31:09 spool/storage|backup_20241219193059.zstream.gz.pgp.vol3 - passed checksum!
2024/12/19 19:31:09 spool/storage|backup_20241219193059.zstream.gz.pgp.vol2 - passed checksum!
2024/12/19 19:31:09 Done. Elapsed Time: 354.358288ms
2024/12/19 19:31:09 Done - all backup chunks validated.

failure:

2024/12/19 19:30:13 spool/storage|backup_20241219190011.zstream.gz.pgp.vol4 - passed checksum!
2024/12/19 19:30:13 error trying to download file spool/storage|backup_20241219190011.zstream.gz.pgp.vol2 - SHA256 hash mismatch for spool/storage|backup_20241219190011.zstream.gz.pgp.vol2, got be72cbadf45d0693655b8cd022b06b6ee105191b8800816e052665148f84c3f3 but expected 2cdd7a410793404b89ab8e3996dbb982281b896e016e85b11ff574ec701f9554
2024/12/19 19:30:13 spool/storage|backup_20241219190011.zstream.gz.pgp.vol3 - passed checksum!
2024/12/19 19:30:13 spool/storage|backup_20241219190011.zstream.gz.pgp.vol1 - passed checksum!
2024/12/19 19:30:13 error trying to download file spool/storage|backup_20241219190011.zstream.gz.pgp.vol2 - SHA256 hash mismatch for spool/storage|backup_20241219190011.zstream.gz.pgp.vol2, got be72cbadf45d0693655b8cd022b06b6ee105191b8800816e052665148f84c3f3 but expected 2cdd7a410793404b89ab8e3996dbb982281b896e016e85b11ff574ec701f9554
2024/12/19 19:30:15 error trying to download file spool/storage|backup_20241219190011.zstream.gz.pgp.vol2 - SHA256 hash mismatch for spool/storage|backup_20241219190011.zstream.gz.pgp.vol2, got be72cbadf45d0693655b8cd022b06b6ee105191b8800816e052665148f84c3f3 but expected 2cdd7a410793404b89ab8e3996dbb982281b896e016e85b11ff574ec701f9554
2024/12/19 19:30:16 error trying to download file spool/storage|backup_20241219190011.zstream.gz.pgp.vol2 - SHA256 hash mismatch for spool/storage|backup_20241219190011.zstream.gz.pgp.vol2, got be72cbadf45d0693655b8cd022b06b6ee105191b8800816e052665148f84c3f3 but expected 2cdd7a410793404b89ab8e3996dbb982281b896e016e85b11ff574ec701f9554
2024/12/19 19:30:18 error trying to download file spool/storage|backup_20241219190011.zstream.gz.pgp.vol2 - SHA256 hash mismatch for spool/storage|backup_20241219190011.zstream.gz.pgp.vol2, got be72cbadf45d0693655b8cd022b06b6ee105191b8800816e052665148f84c3f3 but expected 2cdd7a410793404b89ab8e3996dbb982281b896e016e85b11ff574ec701f9554

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant