Recently I encountered something annoying, the photo album on my mobile phone suddenly became unavailable. At first, I thought that there was a software problem with Xiaomi's mobile phone, but after I found that there are problems with the movies that I saved on the bulk microSD cards (hereafter called micro sd card) too, I finally found the source of the problem: micro sd card. This surprised me a bit. After all, the Samsung EVO Plus 128GB micro sd card I bought was not cheap. Because of my deep knowledge of the micro sd card structure and channels, I have always recommended others to buy Samsung or SanDisk cards. And I usually just watch movies and take photos occasionally. I am not a selfie taker or a "video recording enthusiast." In theory, I do not need a high endurance SD from the Samsung’s high-end Pro series. Maybe I am just unlucky this time, that I encountered a card with questionable quality. What should I do? Although Samsung EVO claims a ten-year warranty, what should I do with my personal data?
I decided to debug. I plugged the micro sd into my Raspberry Pi, and started an "fantasy journey" in the afternoon. After some frustration, I found that almost all block can be successfully complete reading instructions, but failed almost all writing operations. This indicates that there is a problem with the Flash Translation Layer (FTL) layer of the micro sd card, and bad blocks may have caused the failure of the new mapping relationship completely. More knowledge about FTL can be found in my Zhihu column.
Fortunately, the mapping table is not damaged, so reading operations can be completed, and the existing data is still safe. After backing up all my photos and movies, I took a relief. But when I look at this micro sd again, there is another problem. If I want to use the guarantee, I need to return the old micro sd card, and because I can’t write on it, I ca n’t delete any data. Who knows what will Samsung ’s after-sales do to my selfies and movies! micro sd has price but data is priceless. For the sake of security, I will use my ultimate method.
Claw hammer, an essential tool for data security experts!
This incident reminds me that a lot of friends asked me if there is an FTL layer in the micro sd card after reading my NAND Flash series and SSD hard drive series articles. There are also many misunderstandings on the Internet that micro sd cards have no FTL layer. In order for everyone to have a clear knowledge of micro sd cards, today we will take a look at the composition of micro sd and respond to misunderstandings.
There are many online materials about the origin of micro sd, so I will not further introduce. I believe that everyone hopes that their mobile phones can support micro sd cards. After all, you can purchase an additional capacity of 256G for a little more than 500 yuan, and can completely exceed the capacity of the flagship iPhone. Although micro sd is not as fast as the built-in NFS Flash, it is more than enough for storing photos, images and data. micro sd is small in size too:
It is so small that many people think that it contains only NAND Flash but nothing else, but is it true?
The structure of micro sd card is very compact. It is not as easy to disassemble SD card as it is to disassemble an SD card, and it is likely to damage the card. Fortunately, a professional data recovery company has done this before (Reference 1), let's take a look at what is inside of the card:
Original micro sd
I used a file here, but some people use acid to corrode the outer casing in order to get a clearer vision. You might be very surprised to see such a complex structure, but if we look at its real block diagram, you may be even more surprised!
It is no exaggeration to describe micro sd as a small SSD. A simplified block diagram of micro sd is as follows:
It includes its own controller, memory (possibly comes with the controller), and NAND Flash. Guess what this controller is?
It's ARM! Transmission speed can only be ensured when ARM and DMA work in coordination, especially on most Class 10 micro sds. For example, Samsung ’s micro sd card mostly uses ARM7TDMI (see Reference 2 for details). It is based on the ARMv4T architecture. T stands for Thumb instruction set. D means support JTAG debugging. M means fast multiplier. I means an embedded ICEBreaker module:
The small micro sd card also has a program, that is, a firmware, and Samsung's firmware has a size of 128KB.
As far as I know, this ARM7TDMI runs at a frequency of 100MHz. It's not very expensive. Depending on the volume of shipments, its Cost is between $0.10 and $0.30.
Many people didn't expect that although micro sd card is small, it is complete. It has ARM controller plus firmware, and includes all elements of Von Neuman. it implements the FTL layer, thereby achieving load balancing. Although the SD card standard does not explicitly require load balancing, some specially designed writing operations can worn out micro sd cards within minutes, if there is no FTL layer for load balancing which is unacceptable. Therefore, almost all micro sd cards implement the FTL layer.
It is interesting many SD cards now directly embed a micro sd card to save costs for convenience.
There are also many weird ways, for example, SSD is actually a pile of micro sd cards, which is very interesting.
Some friends in the comment area asked about the difference between TF card and micro sd. Now it can be said that they are the same thing. There are historical reasons for why they have different names. In short, TF (TransFlash) was invented earlier, and later absorbed and merged by the SD card organization, so they become almost one thing, with a little difference, see reference 3 for details, but general users could not feel it.