Is it possible to wear-level a FAT32 file system? Because SD cards use flash memory, they should requires wear leveling to avoid significantly shortening the life of the card. At the same time, my understanding is that they usually use a FAT32 file system.
My understanding of FAT32 is that there is a small &quot;file system description&quot; block at the beginning of the device, which is followed by the file allocation table (FAT) describing which files are stored where. However, because the FAT needs to be updated every time a file is moved/copied/appended/etc, then doesn't that mean the FAT gets written to many times more often than the rest of the card?
For example, if each erasable block of an SD card is 4 KB, and it uses a 32-bit address space, they each erasable block of the FAT contains 128 addresses, so the FAT should get erased and written ~128 times as often as the rest of the device. If this hypothetical device has an expected life span of &gt;100k cycles, then should it not wear out around 1k cycles if it spends the entire time formatted with a FAT32 file system?
And, if my current understanding is true, then wouldn't FAT32 be basically the worst possible way to format a flash memory device? Or is this a problem that all file systems have, so FAT32 isn't apreciably worse than anything else?
The OS references blocks using a &quot;logical block address&quot;.  The SD card then maps this to a physical page of flash memory.  With wear leveling, each time data in that block is changed, it will get mapped to a new physical page of flash memory.  So, even though the OS is changing the same &quot;logical block address&quot; every time, this is causing different physical pages in flash to be erased and rewritten.  This spreads out the &quot;wear&quot; across the entire flash device, lengthening its lifetime and avoiding the problem you mentioned.  In other words, although the FAT32 is stored at the same &quot;logical block address&quot;, it isn't stored on the same physical page of flash memory every time it is modified.
I'd expect that any commercial flash storage device you buy today will be using wear leveling, because of exactly the problem you mention if wear leveling isn't used.  This problem is not specific to FAT32; it occurs with essentially all conventional filesystems.