Usable size of the littleFS based Posix filesystem

I am wondering about the actual number of bytes the 2MB filesystem can hold, under different circumstances.

According to AN035 File System | Datasheets | Particle using the maximum 200 files for smooth wear leveling (each with 1 sector of meta data and 1 sector of actual data), it sounds like you can best case save 800K of you data when you max out each file?

Thanks for logging the ticket. We will check on this and update you. I will remember to update this thread. :slight_smile:

The 200 file recommendation is based on the the 2 MB file system on most Gen 3 devices. This is 512 sectors at 4096 bytes per sector. Each file takes two sectors minimum, one for metadata and one for file data. The 200 just rounds down from 256 to leave space for system files and other directory overhead.

If you store 4096 bytes per file, then that’s 819,000 bytes of file data for 200 files. However, if you only store 1024 bytes per file, that’s only 204,800 bytes of usable data, as the space lost to unused space in the sectors adds up.

If you store 16,384 bytes per file (4 sectors of data and 1 metadata), then you’re limited to around 80 files but 1,310,820 bytes of file data because of the lower relative overhead for metadata.

3 Likes