Method for verifying disk copy?

Can any of you FreeBSD experts recommend a method for verifying that a disk copy (performed with dd) produced an exact copy of the source disk? I was thinking that maybe an MD5 hash of the disk would work, but I'm unsure how to do this (the md5 man page says it works on files).

I have need to do this with some FreeBSD systems, and want to be able to produce evidence that the copy didn't alter anything. Any suggestions would be appreciated.
 
You answered your own question. Yes md5 will create a hash code. check against the original and copy. if the numbers match then your evidence that you did a bit for bit copy is there.
 
Getting an md5 of a disk is the same as dd-ing it to another disk, just pipe it to md5(1).

Hopefully you zeroed the target disk before the copy, or any extra data at the end of the disk will mess up the checksum.

If you've used the original disk since the copy, it won't match anyway: filesystem mount dates, access times, metadata changes. mtree(8) might work.

There are better ways to duplicate a disk.
 
Back
Top