2
\$\begingroup\$

I have several SD cards with a damaged filesystem. As I analysed them with different hex editors (active diskeditor, wxhexeditor, and bless) I found unreadable sectors at the beginning of the filesystem especially in places where you don't expect a high write endurance.

One card has errors after the FAT boot sector (>243), and another one has errors in the hidden sector area (150-230). These sectors seems to have a hard error since I can't even read data from them. Neither with the command sudo dd if/dev/sdd bs=512 skip=249 nor with hex editor tools.

The main concern I have is when I format the SD cards with the SDFormatter V4.0 in quick format mode, the bad sectors are gone and everything works fine. This disagrees with the assertion that the concerned sectors had hard errors since the quick format mode only initializes the filesystem without initializing the card on low level.

Bad sectors only can be excluded from the S.M.A.R.T register on the SD card, and this requires low level formatting.

What can cause such a failure? The signal integrity seems to be OK. Voltage, threshold levels, and the timing are also fine. One thing I can’t really check is the firmware. Is it possible to get the SD card goes bad only by messing with the firmware?

One of the cards was sent to the manufacturer. They found out that the card has no errors. But they could not tell me what the problem could be. Has someone an idea how to find out what problem it could be? Has anyone dealt with a similar problem?

Operation Mode:

  • CLK=13 MHz
  • SPI
  • FAT16

Read error in hidden sector area at the beginning of the FAT boot sector

Here are some facts about the SD card and its usage:

  • Supports wear leveling
  • High Level Cell 2 GB
  • Hyperstone S6 Flash controller
  • Used at normal conditions (room temperature)
  • MTTF weeks to several months
  • Only a few gigabytes (approximately 3 GB per month) will be transferred to the card.
\$\endgroup\$
5
  • \$\begingroup\$ Have you tried asking this question on the Unix/Linux forum? \$\endgroup\$
    – skvery
    Commented Mar 8, 2017 at 9:52
  • \$\begingroup\$ No, unfortunately not. I checked the card under linux and windows with a sd card reader. I had same results under both operating systems. The card is controlled by a blackfin microcontroller. \$\endgroup\$
    – Armin
    Commented Mar 8, 2017 at 10:14
  • \$\begingroup\$ Only the manufacturer can tell. SD cards use wear leveling, meaning the same sector can be physically stored in a different flash page after each write, so don't expect your theories about individual sectors to hold true. \$\endgroup\$ Commented Mar 8, 2017 at 13:01
  • 1
    \$\begingroup\$ You didn't tell how often they were used, in what conditions, how old the cards are, which technology they use. Newer cheap SD cards with Multi Level Cell are manufactured to achieve a certain quality, but the temperature range is small (a lot smaller than a mechanical hard disk) and they rely more on the microcontroller to fix problems. Is there a common factor when you tested them ? For example the same computer, the same USB cable, the same card reader ? Try to change that. \$\endgroup\$
    – Jot
    Commented Mar 8, 2017 at 15:57
  • \$\begingroup\$ The SD card supports wear leveling. \$\endgroup\$
    – Armin
    Commented Mar 9, 2017 at 12:53

1 Answer 1

5
\$\begingroup\$

Your confusion comes from the fact that SD cards are more complicated than they seem. Unlike magnetic disks which have physical sectors (so that sector 0 is always on the same place on the disk), flash storage is made of pages and blocks, and sectors are dynamically mapped to pages containing relevant data: enter image description here

Since only complete blocks can be erased at once, writing to the SD card results in the old page being marked as invalid, while the new data for the sector is written to a new page, potentially in a different block.

Moreover, when a block accumulates enough invalid pages, it is recycled: remaining valid pages are written elsewhere and the whole block is erased. That's what could have happened when you formatted the card: your bad sectors got relocated to different pages, which are not bad anymore. If the card is smart enough, it should remember blocks which had read errors, and avoid reusing them in the future. So it's entirely possible that your SD card will be error-free from now on, until the day more blocks become unstable due to wear, resulting in more read errors.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks. I believed that the formatting tool initializes the sectors manually by writing zeros on it. Some of the errors occurred after switching off the device by pulling the plug. Could it be possible that an unexpected power loss during a wear leveling process can cause these problems? \$\endgroup\$
    – Armin
    Commented Mar 9, 2017 at 13:44
  • 1
    \$\begingroup\$ @Armin Sure it's possible, but whether it really was the case is a matter of speculation without the knowledge about that particular SD card's inner structure. \$\endgroup\$ Commented Mar 9, 2017 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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