5

I use badblocks to test my 32GB class-10 microSD card that I use to boot my RPi. I already have a functioning file system on it, so I don't want to scan it with the -w option (destructive read-write test).

I have two options: I could use the default read-only test, or I could use a non-destructive read-write test (which is done by backing up the sector, testing it destructively, and then restoring the sector's original content).

What should I consider when I choose the test type? I would like it to be as fast as possible, but I also need accurate results.

eden881
  • 205

1 Answers1

7

The read-only test only reads. That's basically the default testing method for just about everything and pretty much the same what disks do for SMART self-tests.

The non-destructive read-write test works by overwriting data, then reading to verify, and then writing the original data back afterwards. The only way to verify that writing data works is by actually writing data, no read-only test will ever do that for you.

People who only do read tests (the majority, simply because write tests take at least twice as long) simply take it on good faith that when reading works, writing (and being able to read the data that was written later) will probably work too.

However, the non-destructive is relative... after all the very write itself might destroy it (on a medium with limited write cycles) and once it's broken there is no way to write the original data back either, so even though the test is non-destructive, if your hardware is faulty it might still lose you some additional data.

Therefore you shouldn't use badblocks if there is data on a medium you hope to recover. Especially not if you already know it's going bad... if you don't have a backup already, just do the ddrescue directly. That also happens to be a read-only test and the logfile will tell you where the error zones are...

frostschutz
  • 48,978
  • If you need to perform a simple read test, then the SMART Extended test would be the fastest, since the data is not transferred to the host PC. Regarding test programs that write to the drive, you neglect to mention that wear-leveling (as used on semiconductor storage drives) tends to render the results meaningless. – sawdust Aug 13 '19 at 08:57