Filesystem
A LittleFS partition is 8 MB, but only about 6.6 MB can actually be written. Is this abnormal?
No. This is normal LittleFS behavior by design.
LittleFS reserves part of the space for the file system's own management, including:
- metadata
- block/page management structures
- wear leveling
- redundancy and consistency protection
As a result, the usable data space of a LittleFS partition is smaller than the total partition size. Typically, around 15% ~ 25% of the partition is reserved for these purposes.
Additional notes:
- For an
8 MBpartition, an actual usable capacity of about6.5 MB ~ 7 MBis normal. - This reserved space helps improve flash lifetime and filesystem stability.
How can an SD card be mounted as a LittleFS filesystem in ESP-IDF?
Initialize the filesystem as littlefs first in code:
esp_vfs_littlefs_conf_t conf = {
.base_path = "/littlefs",
.partition_label = "storage",
.format_if_mount_failed = true,
.dont_mount = false,
};
Then enable littlefs support in the configuration.

The default block_cycles value in LittleFS is 500. If every block exceeds this threshold, is formatting the partition the only way to recover?
block_cycles is a configurable software-level threshold used to proactively trigger block replacement and wear-leveling operations. It is not the same thing as the physical endurance limit of the flash blocks.
Once all blocks reach this threshold, the filesystem may indeed perform wear leveling and garbage collection more frequently, which can reduce performance to some extent. However, this does not mean formatting the partition is the only way to "recover".
- If the hardware has not yet reached its endurance limit, formatting is only a short-term mitigation and may temporarily reduce the frequency of wear-leveling activity.
- If the hardware itself is already close to or at its endurance limit, formatting will not fundamentally solve the problem.
- In real products, the
block_cyclesvalue can also be increased appropriately based on the application scenario.
How can esp_mmap_assets be used to store .ttf font files and load them in LVGL?
Place the font files in a dedicated asset directory, then add spiffs_create_partition_assets to the CMakeLists.txt file under the main directory so the font directory is packaged into a filesystem partition.
Example:
spiffs_create_partition_assets(fonts "../font_assets" FLASH_IN_PROJECT)
Here, ../font_assets is the directory containing the .ttf font files.
