Page 1 of 3

littlefs - advantages & disadvantages

Posted: Sat Nov 09, 2019 6:01 am
by devnull
search.php?keywords=littlefs&terms=all& ... mit=Search

The search did not bring up anything obvious, but what are the main advantages and disadvantages of littlefs (other than the name suggests it is little !)

Re: littlefs - advantages & disadvantages

Posted: Sat Nov 09, 2019 6:46 am
by kevinkk525
the "little" is the main advantage for me :D The esp8266 gets 4kB more free RAM when using it, so I made it the default right away!

Apart from that I "heard" it should be more robust than FAT but can't tell anything about that.

Re: littlefs - advantages & disadvantages

Posted: Sat Nov 09, 2019 8:35 am
by pythoncoder
That's interesting, I didn't know it had been implemented.

FAT is pretty bad on Flash devices because the low numbered sectors get rewritten frequently. Devices like USB sticks have wear levelling code, but if you're accessing raw hardware wear is a potential issue.

Re: littlefs - advantages & disadvantages

Posted: Sat Nov 09, 2019 8:42 am
by rcolistete

Re: littlefs - advantages & disadvantages

Posted: Sat Nov 09, 2019 1:56 pm
by mattyt
The littlefs Github, especially the Design page, is full of really useful information. In short, it's a filesystem designed for an embedded environment so it's resilient to power failure, provides wear leveling and uses RAM judiciously.

Re: littlefs - advantages & disadvantages

Posted: Sun Nov 10, 2019 9:40 am
by pythoncoder
Is there any information on which platforms support it and how to configure it?

Re: littlefs - advantages & disadvantages

Posted: Sun Nov 10, 2019 10:52 am
by kevinkk525
There was a PR for esp32 and I noticed the commits for esp8266. Not sure any other platform supports it yet.

Code: Select all

from flashbdev import bdev
import uos
uos.VfsLfs2.mkfs(bdev)
vfs = uos.VfsLfs2(bdev)
These are the changes I made to the module inisetup.py to make usage of littelfs default. As soon as you format your flash with LittleFs, it will be used. But it's not the default FS on any port (yet?).

Re: littlefs - advantages & disadvantages

Posted: Sun Nov 10, 2019 2:37 pm
by rcolistete
Pycom MicroPython has LittleFS since firmware v1.19.x.

Re: littlefs - advantages & disadvantages

Posted: Mon Nov 11, 2019 12:01 am
by jimmo
It's still in progress for STM32...

One disadvantage of LFS is that it won't work with USB MSC unless your PC has LFS filesystem support (which I understand you can do with a FUSE implementation). But for people who disable USB MSC anyway (or use any port other than STM32) this obviously won't make a difference.

Overall though, it's a filesystem designed for flash rather than the constraints of an early-80's PC.

As far as I understand, the extra RAM that Kevin points out is because it can run at the correct block size, so doesn't need an additional buffer. (i.e. this isn't really the "little" in littlefs, it's more a limitation of the way FAT works on these devices).

Re: littlefs - advantages & disadvantages

Posted: Tue Nov 12, 2019 9:06 am
by garima48
Thanks for this great information