FATFS sector size and wear levelling
Posted: Wed Oct 16, 2019 12:06 pm
I have a small configuration file to store in onboard flash. The configuration file is writen on each setting change. As some settings are exposed in an API then I need wear leveling.
The NVS system does not seem to support wear levelling.
I tried FATFS. The manual says:
I can set sector size to 512 to create a more reasonable size, however:
It is not clear how sector size works with respect to wear leveling. If sector size is telling the wear leveler that the hardware sector is 512 bytes then the wear leveler may simply move to the next block. With a small file size this may just result in the true (4096) sector being writen twice.
Does the wear leveler do something like always move forward and then wrap?
Q) Will a small file be properly 'leveled' when sector size = 512 but hardware sector is 4096?
Q) Why must allocated size be > sector size e.g. the default requires 4096*4096 bytes which is 16M?
Or pehaps I am muddled?
The NVS system does not seem to support wear levelling.
I tried FATFS. The manual says:
and thatThe wear levelling component, together with the FAT FS component, uses FAT FS sectors of 4096 bytes, which is a standard size for flash memory.
Which is obviously won't fit in an ESP32..allocation_unit_size ... Must be a power of 2, between sector size and 128 * sector size.
I can set sector size to 512 to create a more reasonable size, however:
It is not clear how sector size works with respect to wear leveling. If sector size is telling the wear leveler that the hardware sector is 512 bytes then the wear leveler may simply move to the next block. With a small file size this may just result in the true (4096) sector being writen twice.
Does the wear leveler do something like always move forward and then wrap?
Q) Will a small file be properly 'leveled' when sector size = 512 but hardware sector is 4096?
Q) Why must allocated size be > sector size e.g. the default requires 4096*4096 bytes which is 16M?
Or pehaps I am muddled?