Patent ID: 7991942

Claim:
A method for managing a storage device based on a flash memory, the method including the steps of: mapping a logical memory space of the storage device, including a plurality of logical blocks, on a physical memory space of the flash memory, including a plurality of physical blocks adapted to be erased individually, the physical blocks including a set of first physical blocks corresponding to the logical blocks and a set of second physical blocks for replacing each bad physical block being unusable, and wherein the second physical blocks are unreserved blocks in the physical memory space after the operation of mapping the logical memory space on the physical memory space has occurred, wherein each logical block includes a plurality of logical sectors adapted to be written repeatedly, and wherein each physical block includes a plurality of physical sectors adapted to be programmed once, consecutive versions of the logical sectors of each logical block being stored in succession in the physical sectors of a root physical block and at least one child physical block when the root physical block is full; detecting each bad physical block; discarding each bad physical block to prevent using the bad physical block for mapping the logical memory space; and defining a mapping structure for mapping each logical sector on an associated physical sector of a corresponding physical block storing the last version of the logical sector, wherein for each written logical block having at least one logical sector being written the mapping structure includes a sector map having a field for each logical sector of the written logical block, the field storing an indication of the associated physical sector when the logical sector is written or a value equal to the indication of a predefined physical sector when the logical sector is empty, and a validation field for storing an indication of the logical sector having data stored in the predefined physical sector.