How to confirm that a cloned external hard drive is accurately cloned?
I've found a way to use some command line tools to recursively check hashes of the individual files. Here's my commands:
hashdeep -rel -r . > hashdeep-outout.txt
Hashdeep (which you can install via homebrew) will create a CSV file listing each individual file with various hashes including MD5 and SHA256. -rel
lists the files with the relative path to the CWD, so I can run this command on both the old drive, and the new cloned drive, and the file names will be identical.
sort --field-separator=',' --key=4 hashdeep-output.txt > hashdeep-sorted.txt
This sorts the CSV file by filename (the 4th field), so that when I compare the two files (for the old drive, and the new drive) everything will be in the same order.
- Then I use just
diff
to compare the sorted output files. If there is anything which was copied incorrectly, it will let me know because the hashes won't match up.