littlefs - advantages & disadvantages

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
devnull
Posts: 394
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

littlefs - advantages & disadvantages

Post by devnull » Sat Nov 09, 2019 6:01 am

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 !)

kevinkk525
Posts: 511
Joined: Sat Feb 03, 2018 7:02 pm

Re: littlefs - advantages & disadvantages

Post by kevinkk525 » Sat Nov 09, 2019 6:46 am

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.
Kevin Köck
Micropython Smarthome Firmware: https://github.com/kevinkk525/pysmartnode

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

Re: littlefs - advantages & disadvantages

Post by pythoncoder » Sat Nov 09, 2019 8:35 am

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.
Peter Hinch

User avatar
rcolistete
Posts: 161
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil

Re: littlefs - advantages & disadvantages

Post by rcolistete » Sat Nov 09, 2019 8:42 am


User avatar
mattyt
Posts: 248
Joined: Mon Jan 23, 2017 6:39 am

Re: littlefs - advantages & disadvantages

Post by mattyt » Sat Nov 09, 2019 1:56 pm

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.

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

Re: littlefs - advantages & disadvantages

Post by pythoncoder » Sun Nov 10, 2019 9:40 am

Is there any information on which platforms support it and how to configure it?
Peter Hinch

kevinkk525
Posts: 511
Joined: Sat Feb 03, 2018 7:02 pm

Re: littlefs - advantages & disadvantages

Post by kevinkk525 » Sun Nov 10, 2019 10:52 am

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?).
Kevin Köck
Micropython Smarthome Firmware: https://github.com/kevinkk525/pysmartnode

User avatar
rcolistete
Posts: 161
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil

Re: littlefs - advantages & disadvantages

Post by rcolistete » Sun Nov 10, 2019 2:37 pm

Pycom MicroPython has LittleFS since firmware v1.19.x.

User avatar
jimmo
Posts: 830
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: littlefs - advantages & disadvantages

Post by jimmo » Mon Nov 11, 2019 12:01 am

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).

garima48
Posts: 1
Joined: Tue Nov 12, 2019 9:04 am
Location: Pune
Contact:

Re: littlefs - advantages & disadvantages

Post by garima48 » Tue Nov 12, 2019 9:06 am

Thanks for this great information

Post Reply