Skip to content

Instantly share code, notes, and snippets.

@timabell
Last active January 7, 2024 21:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timabell/f70f34f8933b2abaf42789f8afdbd7d5 to your computer and use it in GitHub Desktop.
Save timabell/f70f34f8933b2abaf42789f8afdbd7d5 to your computer and use it in GitHub Desktop.
hashdeep orchestrator for data integrity checks in home folder
#!/bin/sh -v
cd ~
hash_file="Documents/hashdeep-checksums.txt"
mv "$hash_file" "$hash_file.bak"
time hashdeep -c md5 -of -r -l Music Downloads Documents Pictures Phone Dropbox repo oneplus9-home | tee "$hash_file"
#!/bin/sh
backuproot="/media/tim/backup/backintime/any/tim/1/last_snapshot/backup/home/tim"
hash_file="$backuproot/Documents/hashdeep-checksums.txt"
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
output_file="$tmp_dir/hashdeep-checksums-verification.txt"
cd "$backuproot"
time hashdeep -k "$hash_file" -rle -of Music Downloads Documents Pictures Phone Dropbox repo oneplus9-home -avv | tee "$output_file" | grep "Known file not used"
xed "$output_file" &
echo '"Known file not used" means there was no match for this hash, i.e. deleted file'
echo '"No match" means new/modified file'
#!/bin/sh
cd ~
hash_file="Documents/hashdeep-checksums.txt.bak"
output_file="Documents/hashdeep-checksums-verification.txt"
mv "$output_file" "$output_file.bak"
time hashdeep -k "$hash_file" -rle -of Music Downloads Documents Pictures Phone Dropbox repo oneplus9-home -avv | tee "$output_file" | grep "Known file not used"
xed "$output_file" &
echo '"Known file not used" means there was no match for this hash, i.e. deleted file'
echo '"No match" means new/modified file'
#!/bin/sh
cd ..
hash_file="Documents/hashdeep-checksums.txt"
output_file="/tmp/hashdeep-checksums-verification.txt"
missing_file="/tmp/hashdeep-checksums-verification-missing.html"
mv "$output_file" "$output_file.bak"
time hashdeep -k "$hash_file" -rle -of Music Downloads Documents Pictures Phone Dropbox repo oneplus9-home -avv | tee "$output_file"
# https://github.com/timabell/paths2html
grep "Known file not used" "$output_file" | sed 's/:.*//'| sort | paths2html | tee "$missing_file" && xdg-open "$missing_file"
# Odd terminology from md5deep verify:
# - "Known file not used" means there was no match for this hash, i.e. deleted file
# - "No match" means new/modified file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment