LittleFS file handling

I have the following problem:
I have a huge config file for my network called /clientAddress. This is maintained by the device and stores stuff like “which devices in this network are active, what is their last status” etc.
this is too big for preferences.h, so no chance to store it there.
Now i also have html/css/js files for my webserver.
If I use platformio’s “upload filesystem image” to change the html / css/js files then the config file gets overwritten (which makes sense).
One option would be, to - upon “upload filesystem image” - somehow download the config file, store it and then upload it with the rest, but i fail to see how that’s possible without a lot of hassle?
Are there any other options?

Since your previous questions refer to the ESP32 S3, I assume that this also applies to this question.

Create a custom partition table and add another partition:

  • Name / Label: “config”
  • Type: “data”
  • SubType: “spiffs”

You would need to adjust the size and offsets of the existing partitions accordingly.

In the sketch you could then use the “config” partition as follows:

#include <LittleFS.h>

fs::LittleFSFS configFS;

void setupConfigFS() {
    configFS.begin(true, "/", 10, "config");

This partition is ignored when a file system image is uploaded.

@hdsjulian Here is a small example project for you:

Note: “Upload Filesystem Image” will use the last data partition (“website” in this case). See Upload file system to a specific spiffs partition

For this reason, the “config” partition is placed before the “website” partition:

1 Like