NAND memory in the form of SD cards (such as SDHC and SDXC), micro SD cards and CF cards have almost replaced 35mm film as the de facto storage medium for most camera devices.
Last week a customer who had photos from a family wedding and a trip to Ethiopia contacted us because his 4TB SanDisk SD card could no longer be read by his Canon EOS camera or his Apple Mac computer. The latter presenting him with the error message “The disk you inserted was not readable by this computer”. This error can sometimes be caused by partition or controller failure. In this case, a quick diagnostic test on our NAND reader made a controller issue the most likely cause.
The controller in NAND memory devices serves the important role of managing read and write cycles. It also performs a process known as “wear-levelling” – a feature which optimises the utilisation rate of all cells evenly across a die. It also performs the important role of logical block addressing, mapping information from the logical block address to the physical addresses. The controller chip also manages bad blocks. Just as a hard disk uses a P-List and a G-List, many NAND chips use Bad Block Omission and Bad Block reallocation algorithms. For cells which have been subject to the erase function, the garbage collection function designates them as “free” for new recording cycles.
Each controller type will use different LBA and page schemes. The accurate determination of these is crucial for successful data recovery. Typically, the page size is 512 bytes. In this particular case, the page size was 512 bytes with a logical block size of 1024 bytes. After having created a virtual image of the disk, we analysed the inversion and XOR used by the controller. Inversion is a type of encoding commonly used in TLC chips to minimise cell wear. This inversion algorithm must be deciphered. Secondly, we had to work out the XOR used by the controller. User data is merged with a XOR key to (rather un-intuitively) create noise. This is needed by TLC NAND to preserve data quality. After working out the XOR, the virtual and block allocation patterns, we now had a logical image of the SanDisk card to work with.
Logical block number and logical page number sequence had to be calculated followed by data block sorting and filtering. This included removal of invalid and duplicate blocks and checking of LBN integrity.
And then to the final stage…the data extraction phase. Most of the file types were .CR2 (Canon Raw Image), JPEG and .MOV files all of which extracted beautifully. The client collected a DVD with all his treasured memories vowing never to trust a camera card again!