HOWTO: Fix error 'SPIFFS: mount failed' on esp8266 and esp32

Discussion about various user interfaces such as web interface, displays and apps
Post Reply
Posts: 28
Joined: Thu Jan 26, 2023 10:25 am
Has thanked: 18 times
Been thanked: 3 times

HOWTO: Fix error 'SPIFFS: mount failed' on esp8266 and esp32

Post by grgumxlm »

I had error 'SPIFFS: mount failed' on esp8266 and on esp32. The fix was different on both and because i spend some time figuring it out, here my experience about it:

If you have a esp8266 or esp32 that had no openinverter web interface running before on it and would like to install or , then it often happens, that the SPIFFS filesystem does not work. If you connect a serial console to the esp8266 or esp32 you see on both in the log "SPIFFS: mount failed".
If you do not connect a serial console to look a the logfiles and instead continue with ... / or ... / you would be surprised why its not working. The Wifi is working fine but the web interface wont be there at any time.
If you have used before, and now the SPIFFS does not work, then you would be surprised how extreme fast finish. You wont get any error from

The solution:
On esp8266 there was no elegant solution. I was able to get around by checking in arduino-ide to erase the whole memory few times and suddenly SPIFFS worked.

On esp32 there is a elegant and automatic solution. Modify the line ... e.ino#L742 based on ... -329994019 to SPIFFS.begin(true); . The fix to the broken SPIFFS is now build into the image to be applied when needed. Simplified its "If SPIFFS does not work, reformat it to make it work".

Maybe someone experienced could find out why the more elegant esp32 solution does not work on esp8266. When you change ... e.ino#L406 to SPIFFS.begin(true); , the build just fails.

Side note: SPIFFS it deprecated since years. In some future software updates it would be not available any more. The final solution would be to not use SPIFFS any more. Discussion about changing to something else in this topic: viewtopic.php?p=71694#p71694
Post Reply