0

I have a disk which is perhaps broken. I want to write random data to the disk and later verify the md5 checksum.

I write to the disk like this:

dd if=/dev/urandom of=/dev/sda bs=4M status=progress

How to create the md5 checksum while writing to the disk at the same time? I want to see the md5 checksum of the written random data when dd finishes. Also I want to see the progress while writing to the disk.

I have read this post and I created this command:

pv /dev/urandom >(md5sum) > /dev/sdXXX

The problem is it fills up my whole RAM. I got 32GB RAM.

zomega
  • 972

1 Answers1

1

Rather than write your own solution you can use a standard scan utility.

badblocks -w -s /dev/sda

will scan the entire disk, writing patterns to each individual block then reading the block back and comparing the results. Progress is displayed during the scan. You can also specify a number of passes if the default single pass doesn't seem like enough.

doneal24
  • 5,059