1
\$\begingroup\$

Does an SD come from "the factory" with all of its ECC (or spare area) set correctly?

Sometimes when I blindly dd (copy) an entire SD card (that is only partially filled with filesystem info/data -- and otherwise has lots of unused/never-written-by-me raw space) to another one, I will get a (repeatable) read error on a block that is seemingly in a part of the SD that was never written (since it was close to the "end" of the partition).

Since the source SD was otherwise functional, I've always assumed that this read error was indicative of the block having never been written (and thus it didn't have appropriate corresponding ECC). Is this a bad assumption?

[Now that I type this "out loud", I'm thinking that, since there weren't a constant stream of read errors, the error-causing "unwritten block" would need to be somehow special -- perhaps it was a remapped block and thus didn't get an associated ECC?].

\$\endgroup\$
1
\$\begingroup\$

I do believe that SD-cards, like USB memory sticks, are being formatted and quality assured with some sort of mass production tool, and are being formatted with all bad blocks being remapped at the factory, thus there must be no blocks with bad ECC/CRC from the factory.

This does not mean that errors will not appear during operation, it will either self-correct (at the SD-card firmware level), or cause low level operation to fail. Higher level operation, like file system operation, has mechanism to identify constantly failing sector within the cluster and mark respective cluster as bad, excluding it from the read/write pool.

In your case error happens outside of the file system, and the only way to attempt to recover it is to overwrite it - as you say - create new set of data + CRC.

As to the question why it happens for you - it is not possible to identify without looking at how and where it fails, and overwriting the sector may "revive" the sector (logically, not necessarily physically) and there will be no evidence any more.

There's a utility called "SD Memory Card Formatter - SD Association", you can use it to perform full format of the card, and be sure that if there was a bad block it will be remapped.

\$\endgroup\$
1
  • \$\begingroup\$ Interestingly, retrying the read operation typically succeeds. Which now makes me suspect the reader and/or USB infrastructure. \$\endgroup\$ – jhfrontz Mar 5 '20 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.