Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 3 months ago.
FileSystem : LitteFS vs FatFS
hi
im running the LitteFS example program from https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-filesystem/file/5ffb990e0881/main.cpp/.
when i use litteFS, i can n-times reset the device and except for the first time, the device can mount the sd card as normal and increments the numbers.
the same example used with fatFS though can't mount the filesystem when i reset the device after running the example and writing the numbers file, and formats de sd card every time i reset.
do you have an idea why the program is not able to detect that the sd card has already a fat filesystem on it and write to it?
1 Answer
6 years, 3 months ago.
AFAIK that is exactly the point behind LittleFS. With FAT you have a not-so-low chance that the power off corrupted your filesystem. Therefore after restart it cannot mount and has to reformat. You could enhance your test to perform a clean shutdown (via some command over UART for example) or by unmounting the file system right after doing some writing. In that case it should still be intact after restart. Anyway: that "restriction"/risk is one of the (if not THE) reason for introducing LittleFS.