Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It seems that there are many tools out there for Mac OS X that test a hard drive for bad blocks by doing a Read/Verify pass. That is, they read a block, then read it a second time, and verify that both reads yielded the same results.

I need a tool that does a non-destructive Read/Write/Verify pass. It should read each block, write those same contents back out, and then read it again to verify. That way every block gets written, giving the hard drive a chance to spare out bad blocks. But since the same contents that were just read get written back out, it doesn't destroy data that wasn't already lost.

I'm aware of several tools that can do Read/Verify, but I'm not aware of any that do Read/Write/Verify. Are there any tools that do what I want?

Unix / open source tools that compile and run on Mac OS X are fair game too.

share|improve this question
Of course people will understand what you want, but I guess write those same contents back out might also read something like write random contents, verify it, and restore the original content? (I wonder if writing the same content would be a good test, and hence I wonder if that is how such software would work.) – Arjan Apr 30 '10 at 19:03
@Arjan I just need every block written, without destroying any data (that is, without destroying any data that isn't already lost because it's sitting on an unreadable block). And I don't want the additional time and hassle of "Back up everything; Format with 'Zero Out Data'; Restore from backup". – Spiff Apr 30 '10 at 19:33
Yes, that part is clear. But are you sure this implies it should only write the very same data? I'm not an expert, but I presume some tool that would restore the original data after doing some write test (maybe even elsewhere on disk, if it finds some block is faulty) suits your needs as well? – Arjan Apr 30 '10 at 19:37
Sure, I suppose I don't care terribly if another pattern in written between the first read and the write that restores the originally-read data. Well, except for the fact that all those extra writes would probably more than double the run time. On a 1TB drive, that would be 1TB of extra writes, which at a modern sustained write speed of 100 MBtyes/sec could add...what...almost 3 HOURS to the run? – Spiff Apr 30 '10 at 20:39
Arjan is more than right: try to imagine a block that can be read but can't be written and stays the same. With such a block your "system" would report no damage, while his would correctly report the error. – o0'. May 5 '10 at 12:15
up vote 11 down vote accepted

You might want to have a look at badblocks(8), a command-line tool from GNU/Linux. There is a port for Darwin, which you can get from MacPorts:

sudo port -v install e2fsprogs

Having a look at the manual, you can read the -n and -w options' paragraphs:

-n Use non-destructive read-write mode. By default only a non-destructive read-only test is done. This option must not be combined with the -w option, as they are mutually exclusive.

-w Use write-mode test. With this option, badblocks scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on every block of the device, reading every block and comparing the contents. This option may not be combined with the -n option, as they are mutually exclusive.

Hopefully this is what you are looking for.

share|improve this answer
Oops, I kept hoping I would get a chance to try out badblocks and then give you the checkmark if it met my needs, and then I didn't pay enough attention to the bounty expiration date. Sorry I didn't make it in time to give you the full 100 reputation, François. :( – Spiff May 7 '10 at 20:55

The digilloyd disc tester does read/write/verify and is fabulous to boot.


share|improve this answer
Thanks for that link. It seems close to what I need, but I didn't see a way to do a non-destructive read/write/verify across the whole disk. It had the ability to fill up free space on a given partition, but not write every block on the disk (including the boot sectors, and places in the existing volumes that already have files on them, etc.). Did I miss an option? Can you point me at what I'm missing? – Spiff May 7 '10 at 20:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .