I'm wondering if the littlefs block size can be configured in micropython. I am using logfiles to write to.
The command: 'info = os.statvfs("/data")' returns "File system block size: 4096, free blocks: 345"
Does this mean that every created file on the littlefs filesystem is by default 4096 bytes in size? Is it possible to reduce this size?
littlefs block size configurable?
Re: littlefs block size configurable?
block_size is that of the underlying flash chip, e.g. for erase. It does not affect the number and sizes of file. lfs can have more files than blocks.
-
- Posts: 15
- Joined: Tue Aug 09, 2022 11:32 am
Re: littlefs block size configurable?
It was my understanding that with a blocksize of 4096 it does not matter if the filesize is 1 byte or 4000 bytes. The file will be 4096 bytes in size...or isn't this correct?
Re: littlefs block size configurable?
Don’t think so. I just made a little test for confirmation. On a lfs file system with 255 blocks of 4096 byte size I have created 500 files of 256 byte size with different content. I could read them back properly with the right content, and delete them.
Re: littlefs block size configurable?
Yeah the block size for littlefs is just so that it manages the underlying flash device correctly.
Unlike fatfs where a single file must own the entire cluster.
Unlike fatfs where a single file must own the entire cluster.