Page 1 of 1

Limited number of KEYS for NVS partition

Posted: Mon Apr 03, 2023 4:38 am
by Kowshik_Bevara
Hi,

In the partition table, I assigned 32KB to NVS in ESP32S3, but while using the NVS I tried to create 1000+keys with the value of 2 bytes and I got an error saying NOT enough space for storage. Considering each key to be of 2 bytes it accumulates to be only 2000 bytes.

As per my understanding, it seems that storing keys also consumes some space but even if I consider 4 bytes for each key it takes 4000 bytes more.

Does this mean that there is a limit to the number of keys in the NVS partition? If so why is that?

Please help me understand the way that NVS storage is being used.

Thanks in Advance.

Re: Limited number of KEYS for NVS partition

Posted: Mon Apr 03, 2023 6:08 am
by ESP_Sprite
Not only the value gets stored, the key as well, as well as some other metadata. Aside that, each page (sector) of NVS can only store a limited amount of values. See the NVS doc page for how exactly it works.