Does Mongoose OS use LittleFS as the default filesystem for the ESP32?

#1

I am looking at the documentation and it appears as though SPIFFS is used as the default filesystem for the ESP32. I would like to use LittleFS, and I see there is a MOS library that supports this, https://github.com/mongoose-os-libs/vfs-fs-lfs, however I cannot find the parameters to set in the mos.yml file or confirm if the default is SPIFFS.

  1. Is SPIFFS the default file system, or is that replaced with LittleFS?
  2. If not, how can I set the filesystem for the ESP32 to LittleFS?

Thank you.

#2

AFAIK, SPIFFS is the default.
You can select the FS you want to use by defining the partition table and specifying some macros in your mos.yml.
These very days nliviu has given an example for another user, check for it, searching is fun.
The example is for an extra FS, I personally I’m not sure if the root fs can be LFS.
Read the docs here and here
(partition table)

#3

Never tested, but you can add in mos.yml

build_vars:
  MGOS_ROOT_FS_TYPE: LFS

or build with the flag --build-var=MGOS_ROOT_FS_TYPE=LFS

LFS is more efficient with big flash and file sizes, while SPIFFS is more efficient with small flash and file sizes.
IIRC, the SPIFFS’s block size is 512B, while LFS’s is 4096B.

IIRC, the last time when I tested, creating a 8MB or 16MB SPIFFS filesystem took ~60 seconds (and needed to change the default wdt timeout), while LFS needed ~5 seconds.

#4

Thank you. I will try it out. Is there a reason LFS block size is 4096B? It does look like this could be changed, but I am having trouble building esp32 when this parameter is changed.