I'm trying to read files from a NAND flash (K9LAG08U0M) that I took off an old MP3 player, so far I've been able to read the NAND contents successfully by interfacing it to my PC as a USBMSD (Mass Storage Device) using an ARM microcontroller.
The problem is when I connect it, I get an "unknown partition table" error, looking closer the first page it doesn't seem have a valid MBR, after some searching I was able to locate the MBR at offset 0x7e800 (page number 253), this is what I get when using file(1) on that block (the MP3 was formated with FAT32)
x86 boot sector, code offset 0x58, OEM-ID "ALiOS1.0", sectors/cluster 2, reserved sectors 34, Media descriptor 0xf8, heads 255, sectors 248448 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 963, serial number 0x30a3239e, unlabeled
My question is, why isn't the MBR stored on the first page ? does this mean that the controller remapped the first block to another one ? if so, is there a way for me to figure out how bad blocks are managed (without the original controller) so I can do the same mapping in my code to read the filesystem ?
Thanks.
PS: I tried checking for bad blocks to see if block 0 is bad, according to the datasheet an initial bad block is identified by a non-FFh byte stored in the spare area of the last page in the block, but when I tried that almost 80% of the blocks show as bad blocks and the first block is not one of them, does this sound like a reasonable ratio to you ? or am I doing something wrong when checking for bad blocks ?
Some info about the flash:
8192 blocks
128 page per block
2K pages + 64 bytes spare area.