Verify disk wipe #

1. dd & hexdump

dd if=/dev/sdX bs=8192 status=progress | hexdump

2. dd, hexdump, & md5sum

Combine zero verification with simultaneous MD5 hashing:

dd if=/dev/sdX 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.

3. cmp

cmp /dev/sdX /dev/zero
cmp: EOF on /dev/sdX after byte 256060514304, in line 1
blockdev --getsize64 /dev/sdX
256060514304

4. All-Zero Hash Calculator 💾

"[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/sdX
Disk /dev/sdX: 500.1 GB,  500107862016 bytes

testdisk /dev/sdX
Proceed > None > Advanced > Size in sectors
976773168

5. See also

/nix | Jan 29, 2012


RSS | Archives