Electronic – Corrupt, unreadable sectors on an SD card

sdspi

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.

Best Answer

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.