dd if=/dev/sda bs=8192 status=progress | hexdump
sudo diff -s -q --speed-large-files /dev/zero /dev/sda
(A similar result can be obtained via: sudo hexdump /dev/sda | head -n 3
though the process terminates with a "Command terminated abnormally." error message if any nonzero value is encountered).
dd if=/dev/sda bs=1M status=progress | tee >(hexdump -C >&2) | md5sum
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
251000193024 bytes (251 GB, 234 GiB) copied, 1099.66 s, 228 MB/s
...
3a70c70000
f0b051b7e64c7c3ebe055080cdbdf945 -
3a70c70000 is the hexadecimal byte offset from hexdump; converting to decimal (printf "%d\n" 0x3a70c70000
) = 251000193024 bytes. f0b051b7e64c7c3ebe055080cdbdf945 is the MD5 checksum.
"[C]alculates the expected CRC32 (ITU-T V.42), MD5, SHA1 and SHA256 hash values for a specified length of all-zero data." You'll need either the number of bytes or sectors (the latter may be listed on the drive sticker as LBA) to verify the hash:
fdisk -l /dev/sda
Disk /dev/sda: 500.1 GB, 500107862016 bytes
testdisk /dev/sda
Proceed > None > Advanced > Size in sectors
976773168
/nix | Jan 29, 2012