2 Answers
2

To compare disk images byte-for-byte and list all the differing bytes, you can run

cmp -l /path/to/first.img /path/to/second.img

This will compare everything, including any unoccupied space. If these are filesystem images and you want to do a file-against-file comparison, you need to mount them, then use a file comparison tool such as diff or rsync.

The question isn't clear but you may have to mount that image before you can compare (if it is an iso)
–
trentMar 3 '11 at 6:52

But i suppose for this to work my disk images would have to be mounted. Without mounting and simply having it as X.img files can i make a comparison? How about creating a hash value and comparing?
–
user73304Mar 6 '11 at 16:13

@Steven: Hashes are vulnerable to hash collision. You could just diff img1.img img2.img if you want to be sure the images are identical. One disadvantage is that this won't report how the images are different...
–
BorealidMar 6 '11 at 20:04

If you're going to worry about md5 collisions on iso files, you should worry about collisions with rsync (which uses md5 along with a checksum).
–
StevenMar 6 '11 at 22:22