Search code examples
esp8266spiffs

How to know how much space is left in a spiffs partition on a ESP8266?


I need to know how many bytes are left in the SPIFFS partition on my ESP8266 and report it. How do I get that info?

Thanks


Solution

  • I am not sure if this tells you about the blocks that have been marked as deleted but you can look at the free_blocks member in the spiffs_t struct. (There is a delete blocks count too but you could dump all three and that should give you a good idea of what is going on with the flash).

      typedef struct spiffs_t { 
      ....
         // current number of free blocks
         u32_t free_blocks;
         // current number of busy pages
         u32_t stats_p_allocated;
         // current number of deleted pages
         u32_t stats_p_deleted;