Patent ID: 8886990

Claim:
A method for data storage, comprising: storing data in a memory comprising multiple memory cells arranged in blocks, wherein a first subset of the blocks is defined for storing first data with a first storage density, and a second subset of the blocks is defined for storing second data with a second storage density, larger than the first storage density; allocating one or more blocks in each of the first and second subsets of the blocks to serve as spare blocks, wherein a total number of the spare blocks in the first subset of the blocks is greater than a total number of the spare blocks in the second subset of the blocks; replacing blocks that become faulty with the spare blocks; upon detecting that the total number of the spare blocks in the second subset has decreased below a predefined threshold, copying data from at least one block in the second subset to at least one block in the first subset; and adding the at least one block in the second subset to the spare blocks in the second subset.