Skip to content

fix: recover from corrupt littlefs - #3012

Draft
benallfree wants to merge 1 commit into
meshcore-dev:devfrom
MeshEnvy:feature/fs-corruption-check
Draft

fix: recover from corrupt littlefs#3012
benallfree wants to merge 1 commit into
meshcore-dev:devfrom
MeshEnvy:feature/fs-corruption-check

Conversation

@benallfree

@benallfree benallfree commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Hey guys, this is a fix for a rare corner case where littlefs becomes corrupted somehow.

Currently, the device will get locked in a loop the first time it attempts to write to a corrupted littlefs.

This PR does an integrity check at boot. I'm not sure if this is the best approach but here to discuss.

Co-authored-by: Cursor <cursoragent@cursor.com>
@benallfree benallfree changed the title Companion: recover from corrupt littlefs at boot instead of freezing on first write recover from corrupt littlefs Jul 21, 2026
@benallfree benallfree changed the title recover from corrupt littlefs fix: recover from corrupt littlefs Jul 21, 2026
@IoTThinks

Copy link
Copy Markdown
Contributor

So this PR will format FS in case of FS corruption?

My T1000e corrupted FS a few times in last 3 months.

@benallfree

Copy link
Copy Markdown
Contributor Author

@IoTThinks that’s correct. As far as I know, there is no way to recover from a corrupted file system, so you might as well just format it and start again. But if I’m wrong about that, and there is someway to run a file system repair, we should consider that first.

@IoTThinks

IoTThinks commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

It is still better to recover and start over instead of stuck in bootloop.
I guess there is a major flaw in LittleFS. It seems very fragile.

Thanks a lot for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants