ESP32 NVS blob saving question

Hi all
I try to understand the nvs blob saving but I’m not sure if I’m right.

Here is the documentation for NVS.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/nvs_flash.html

The documentation says that:

  • Variable length values (strings and blobs) are written into subsequent entries, 32 bytes per entry.

Does this mean that when I save a uint8_t array with two elements to the same blob, it needs 34 byte or it needs 66 byte?
Calculations are:
34 byte = 32 byte (Entrystructure) + 2 Byte (arrayelements)
66 byte = 32 byte (Entrystructure 1 for element 1) + 1byte (element 1) + 32byte (Entrystructure 2 for element 2) + 1 byte (element 2)

Variable length values (strings and blobs) are written into subsequent entries, 32 bytes per entry. The Span field of the first entry indicates how many entries are used.

The way I read this in the doc means that internally, ESP-IDF will write variable-length values in that structure. The user shouldn’t have to do anything.

You can see that e.g. for the write function, which gets the data, data type, and data length

if the data is a blob, it will use the multi-page write

It will write in chunks of EntrySize, see code at

You can also ask the people who write ESP-IDF what their documentation means or what how the implementation behaves :stuck_out_tongue:Issues · espressif/esp-idf · GitHub