ESP32-S3 SPIFFS file corruption after ~10(8 MB) days of continuous logging
Posted: Tue May 12, 2026 9:52 am
I am using SPIFFS on ESP32-S3 with a 27 MB(Total flash size 32 MB) partition for sensor data logging.
Implementation:
* Sensor data recorded every 2 seconds
* Buffered in RAM
* Buffer flushed to CSV file every 50 seconds
* One file per day
* Oldest file deleted after 30 days
* Using normal fopen/fwrite/fclose operations
Issue:
* First ~10 days of files are correct
* After that, newer files start getting corrupted
* Some files contain random/sketch data
* Some files are much smaller than expected (100 KB instead of ~700 KB)
* Missing records also observed
Has anyone faced similar SPIFFS issues with long-term logging or continuous append operations? Any suggestions or better approach for reliable 30-day logging on ESP32?
Implementation:
* Sensor data recorded every 2 seconds
* Buffered in RAM
* Buffer flushed to CSV file every 50 seconds
* One file per day
* Oldest file deleted after 30 days
* Using normal fopen/fwrite/fclose operations
Issue:
* First ~10 days of files are correct
* After that, newer files start getting corrupted
* Some files contain random/sketch data
* Some files are much smaller than expected (100 KB instead of ~700 KB)
* Missing records also observed
Has anyone faced similar SPIFFS issues with long-term logging or continuous append operations? Any suggestions or better approach for reliable 30-day logging on ESP32?