Skip to content

Change request : SPIFFS autoformat on mount failure #4185

Closed
@vdeconinck

Description

@vdeconinck

This issue to discuss the opportunity to change the default behaviour of SPIFFS mount() and begin().

In the current implementation, if the mounting filesystem fails, the API silently formats the filesystem and mounts it - empty.

Pro: after mount, the programmer is guaranteed to have a mounted filesystem

Con: if the chip is defective, or the API has a bug, or the FS has been formated with incompatible configuration, data gets lost without a warning. This is also contrary to the default behaviour chosen for ESP32

I would suggest to adopt the same convention as the ESP32: SPIFFS.begin() should accept an optional "formatOnFail" parameter, defaulting to false.

This would be breaking change (albeit in the direction of safety), so I guess it would have to be targeted to the next major version,

References:
#2581 (comment)
#4111 (comment)
espressif/arduino-esp32#411 (comment)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions