Does a new flash always overwrite the filesystem?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
cyrano1960
Posts: 39
Joined: Fri Mar 29, 2019 7:08 pm

Does a new flash always overwrite the filesystem?

Post by cyrano1960 » Fri May 06, 2022 12:44 pm

Hello there, I have a simple question, but I can´t find an answer. I wonder if there is a way to flash a board with a new firmware without overwriting the existing filesystem. Thank a lot an best regards, Werner

User avatar
Roberthh
Posts: 3668
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Does a new flash always overwrite the filesystem?

Post by Roberthh » Fri May 06, 2022 1:42 pm

That depends. MicroPython attempts to keep an existing file system. On most ports and devices, that succeeds. The file system will however be re-created, if the initial mount fails. Possible reasons:
- The file system was by chance corrupted. That may happen for instance, when the board is mounted to a PC in MSC mode, and both board and PC wrote to the file system. Or the partitioning of the flash was changed with a new firmware.
- There are some boards/port combination, where a built-in bootloader erase the flash. That happens for instance with the Teensy boards.

cyrano1960
Posts: 39
Joined: Fri Mar 29, 2019 7:08 pm

Re: Does a new flash always overwrite the filesystem?

Post by cyrano1960 » Fri May 06, 2022 3:47 pm

Hi Robert, thanks for your fast response. That explains a lot. I have flashed my Pi Picos several times and there was no change in my filesystem, but then I have done the same on an ESP32 and all my files are gone.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Does a new flash always overwrite the filesystem?

Post by pythoncoder » Sat May 07, 2022 9:15 am

That is not normal behaviour on an ESP32. I have never lost files unless I deliberately erase flash.
Peter Hinch
Index to my micropython libraries.

Post Reply