Maybe your disk on /dev/sdb has been modified by udisks or another process of your OS (automatically mounted for example).
Edit:
Maybe the image is the image of a partition and not the whole hard disk.
You can compare yours disks with fdisk:
fidsk -l /dev/sdb
and
fdisk -l /path/to/image
See the numbers of blocks (and their sizes) maybe it will correspond to a only one partition.
Retry the md5sum on the concerned partition on /dev/sdb:
md5sum /dev/sdbx (x is the number of the partition)
and compare with the md5 of your image
Edit 2:
Your source HDD does a size of 660297728 bytes (660 MB)
so when you have done the dd, it was:
dd if=/dev/sda of=/path/to/image
So the image has the same size of the entire source hdd: 660297728 bytes
If you do a md5sum of the source HDD and image it must be the same.
When you copy the image to the new HDD, you do:
dd if=image of=/dev/sdb
But sdb has a size of 1 TB, so:
- the first
660297728 bytes
has been written by dd
- the next
440 MB
has not been written, the data are the same before dd maybe some zeroes or other.
If you do a md5sum on the entire sdb, you will include the 440 MB
which has not been written and the result will not be the same of the md5sum of image.
If you want to do the md5sum of the new disk, you do:
dd if=/dev/sdb bs=512 count=1289644 | md5sum
The result must be the same.
cmp image /dev/sdb
say? – Skaperen Sep 30 '15 at 11:56cmp /dev/sdb image
sayscmp: EOF on image
. – Martin Sep 30 '15 at 13:26dd if=/dev/sdb bs=512 count=1289644 | md5sum
should returnf5a9d398e974617108d26c1654fe7bcb -
– Alex Stragies Sep 30 '15 at 13:55/dev/sdb
is larger thanimage
becauseimage
reached end-of-file first? In addition,dd if=/dev/sdb bs=512 count=1289644 | md5sum
andmd5sum image
indeed create a same hash. Does this mean thatmd5sum /dev/sdb
reads in all the trailing zeros to first 660297728 bytes? I mean the/dev/sdb
disk is 1024966656 bytes in size and if Idd
the image onto/dev/sdb
, then I write only first 660297728 bytes and rest of the 364668928 bytes are zeros(drive was zero-filled first). – Martin Sep 30 '15 at 15:21EOF on Image
means "/dev/sdb has more stuff to compare, while image ran out of bytes". md5sum without options will always read the entire file/device/stdin given. Yes, dd without options wont invent random bytes to fill the rest of the device after image was completely written. Accept the answer from @frostschutz – Alex Stragies Sep 30 '15 at 17:18