Hard drive checking by using dd and md5sum tools

Solution 1:

One problem is that your hard drive does NOT necessarily fit in full 16MB blocks and as a result the last, lets say 15MB of the drive, is random data from factory or some windows formatting junk, which generates a different md5.

There is nothing to md5 from /dev/zero ! Its virtual. First check whats the logical/physical sector size!

 sudo fdisk -l /dev/sdb

For a new drive it should be 4096. So it means that you can fill your drive with 4096 chunks (block size) of zeros completely, so then:

dd if=/dev/zero of=/dev/sdb bs=4096 conv=notrunc,noerror & pid=$!
kill -USR1 $pidnumer

You can omit the "conv=notrunc,noerror & pid=$!" parts; the kill -USR1 $pidnumer shows you how far the zeroing has progressed. conv and noerror just ensures that every block is tried and upon error (errors are shown in terminal) the zeroing continues. more @

man dd

You can also try to just zero the last 20M of the drive by calculating how many sectors there are and how many you need to skip (check fdisk -l for disk size in bytes). 2,000,000,000,000 bytes/4096=488281250 sectors total. 20,000,768 bytes /4096=4883sectors 488281250-4883=488276367 sectors to seek

 dd if=/dev/zero of=/dev/sdb bs=4096 seek=488276367 conv=notrunc,noerror & pid=$!

then check the md5 again If there were input/output errors dd would show it anyways. Better hdd test tools are smartmontools

smartctl -a /dev/sdb Look for Reallocated_sectors, reallocated sector count, offline uncorrectable, pending sectors. And Error log. Any values of those forementioned is bad news and bring the hdd to warranty. also you can try bonnie++ for example create a partition on the usb disk (doesn't matter what type) , format it and mount it to for example to /dev/sdb1

bonnie++ -u root -d /mnt/sdb1 -n 10:100000000:100:4096 -x 3 -m 5gb

And check the results of bonnie and also /var/log/syslog and other logs for input output errors.