I have a bunch of Class 10 UHS-1 SDHC SD cards from different manufacturers. They are all partitioned as follows
$ sudo fdisk -l /dev/sdj Disk /dev/sdj: 14.9 GiB, 15931539456 bytes, 31116288 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x0000de21 Device Boot Start End Sectors Size Id Type /dev/sdj1 2048 1050623 1048576 512M c W95 FAT32 (LBA) /dev/sdj2 1050624 2099199 1048576 512M 83 Linux /dev/sdj3 2099200 3147775 1048576 512M 83 Linux /dev/sdj4 3147776 31116287 27968512 13.3G 83 Linux
I used a memory card duplicator to copy the images. All cards have the same content.
When I mount the second partition of any two SD cards and compare the content, they are exactly the same.
$ sudo mount -o ro /dev/sdg2 /mnt/system-a/ $ sudo mount -o ro /dev/sdj2 /mnt/system-b/ $ diff -r --no-derefence /mnt/system-a /mnt/system-b/ $ # prints nothing^
However, if I compare the sha1sum of the partitions, they sometimes differ
$ sudo dd if=/dev/sdg2 | sha1sum 1048576+0 records in 1048576+0 records out 536870912 bytes (537 MB) copied, 12.3448 s, 43.5 MB/s ee7a16a8d7262ccc6a2e6974e8026f78df445e72 - $ sudo dd if=/dev/sdj2 | sha1sum 1048576+0 records in 1048576+0 records out 536870912 bytes (537 MB) copied, 12.6412 s, 42.5 MB/s 4bb6e3e5f3e47dc6cedc6cf8ed327ca2ca7cd7c4 -
Stranger, if I compare these two drives using a binary diffing tool like
radiff2, I see the following
$ sudo dd if=/dev/sdg2 of=sdg2.img 1048576+0 records in 1048576+0 records out 536870912 bytes (537 MB) copied, 12.2378 s, 43.9 MB/s $ sudo dd if=/dev/sdj2 of=sdj2.img 1048576+0 records in 1048576+0 records out 536870912 bytes (537 MB) copied, 12.2315 s, 43.9 MB/s $ radiff2 -c sdg2.img sdj2.img 767368
767368 changes, even though
diff didn't see any differences in the content!
And for sanity, if I compare two partitions that had the same sha1sum, I see the following
$ radiff2 -c sdj2.img sdf2.img 0
Here is a breakdown of the different sha1sums I see from different cards. It seems like the manufacturer of the card has a large affect on what sha1sum I get when I use dd to read the drive.
Despite differences in sha1sums, all these cards work for my purposes. However, it is making integrety checking difficult because I cannot compare sha1sums.
How is it possible two SD card partitions could have different sha1sums, yet have the exact same content when mounted?
Answer: So now it works as expected. To clear things up, the inconsistency was caused by the SySTOR duplicator I was using. The copy setting I had it use copied partition information and files, but it did not necessary dd the bits to ensure there was a one-to-one match.