Score:0

SD card ddrescue retrieved everything but badblocks lists bad blocks like crazy; how come?

cn flag

It astonishes me that I was able to perfectly recover an SD card with ddrescue which was used in an RPi for quite a while. But when I'm scanning the SD card with badblocks -nvs bad blocks are listed at a crazy rate. (By the way, before kicking off the rescue operation the RPi was behaving quite erratically.)

Can anybody please explain to me, why ddrescue was able to gloriously recover all of the content, and at the same time badblocks literally shouts at me, this SD card is broken?

guiverc avatar
cn flag
`badblocks` by definition looks for areas (*blocks*) of the disk that are going bad (*have read errors*); which include areas that are still readable, but not always readable (ie. going bad! or dying shown by the *read errors*). `ddrescue` however is expected to recover data, thus allows for re-reading sectors (*ignoring read errors*) UNLESS a *defined* `--max-error-count` is reached... ie. your question makes little sense to me given the very different intentions of those utilities.
participant avatar
cn flag
@guiverc My SD card has an enormous amount of bad blocks, i.e. unreadable blocks. Still, `ddrescue` is able to read even the "unreadable" ones it occurs to me. This puzzles me.
participant avatar
cn flag
I have a 128 GB SD card and `badblocks -nvs` reports 100% bad blocks.
guiverc avatar
cn flag
`ddrescue` will happily retry until `--max-error-count` is reached as already stated... `badblocks` is looking for *failing* blocks, thus a read error-count of 1 is bad news in its code as it's a preemptive tool used to detect what maybe failing media.. a much higher 'bar' than used by `ddrescue` which by intention ignores any 'errors' it gets. Test the card on another device to ensure you don't have a less than ideal card reader etc. Something is *likely* suspect with the card or your hardware used in reading the card (*down to PSU as good components misbehave on bad power*)
participant avatar
cn flag
@guiverc If you make an answer of your comments I'll accept it.
participant avatar
cn flag
@guiverc A different card reader yielded the same result - loads of bad blocks.
guiverc avatar
cn flag
If you used a different machine (ie. ruling out any power situation; ie. a *stressed* power supply that is struggling to provide sufficient power/amperage) then your SD card is dying. Don't forget SD & flash memory is made to cost & has a limited life (esp. write capacity). It's used mostly as relatively *cheap* & *convenient*.
Score:1
cn flag

badblocks looks for areas (blocks/sectors) of the disk that are going bad (have read errors); which include areas that are still readable (though may require more than a single read attempt; ie. are going bad/dying),

ddrescue however is expected to recover data, thus allows for re-reading sectors (ignoring read errors) UNLESS a defined --max-error-count is reached...

ie. the two tools have very different intentions/uses.

ddrescue will happily retry until --max-error-count is reached as already stated... where as badblocks is looking for failing blocks, thus a read error-count of 1 is bad news in its code as it's a preemptive tool used to detect what maybe failing media.. The preemptive tool having a much higher 'bar' than used by ddrescue which by intention ignores any 'errors' it gets.

Your options are

  • test the card on another device to ensure you don't have a less than ideal card reader etc.

Something is likely suspect with the card, or your hardware used in reading the card has a problem of some sort (which could be even PSU, as even good components can misbehave when fed bad power)

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.