No announcement yet.

Using badblocks' non-destructive test to refresh USB flash drives or aging HDDs

  • Filter
  • Time
  • Show
Clear All
new posts

  • Using badblocks' non-destructive test to refresh USB flash drives or aging HDDs

    As you may know, NAND flash uses electrical charge storage to retain information. Over time, charge leakage eventually results in information loss. In order to combat this effect, a reasonable approach would seem to be periodically rewriting the data. To this end, badblocks has a convenient "non-destructive" write testing mode, which I understand: reads a block, writes a pattern, reads back the block to check it against the pattern, then writes back the original data.

    Of course, one could just use dd to copy your data to some temporary storage, then write it back to the device. However, this requires having sufficient scratch space, and doesn't provide the side-benefit of being able to report if there are any bad blocks.

    Now, my question is whether USB flash drives actually require this sort of maintenance, or do their onboard controllers effectively do the same thing upon noticing sufficient charge decay? Presumably, the same question also pertains to modern hard drives, in which the magnetic polarization is similarly subject to decay. I assume modern SSDs do handle this, since I've seen some which specify the amount of time data is guaranteed to be retained without power.

    BTW, it should go without saying that you'll want to check & repair your filesystem first, as the potential for repairs and data recovery would only be hampered by badblocks' write testing.

  • #2
    I guess another note of caution should be not to use a block size that's too small. Otherwise, write amplification could prematurely wear down your storage device (and the process will take longer than necessary).