A previous answer to a post mentions to run sha1 hashes on an images of a dd drive clone image.
Another answer to that post suggests mounting the dd image an then compare if the sha1 hashes of "important files" matches.
I want to use the second approach, but instead of manually selecting files I would like to use a bunch of randomly selected files.
Assuming I have two mounted partitions, can I select a bunch of random files and compare the sha1 hashes and stop with an error if a hash is not equal?
Out put should be roughly similar to this, if all goes well:
OK: all 10000 randomly selected files have matching sha1 sums for partitions sda and sdb
Or the output should only be in case of an error and show the filename that has a different sha1 sum on both partitions.
Current code in progress:
#!/bin/bash N=5 mydir="/home" dirlisting=`find $mydir |sort -R |tail -$N` for fname in $dirlisting do echo $fname done