Partition Schemes in the Arduino IDE

Sliced Pizza

A guide on how to add or edit the flash memory partitions in the Arduino IDE

Sometimes when you are creating a complicated Sketch especially when using WiFi or Bluetooth libraries you can run out of space in the flash memory on your device. You see an error like this

Sketch too big. Sketch uses 2233498 bytes (113%) of program storage space. Maximum is 1966080 bytes.

Most of the time this can be fixed by simply choosing a different in-built partition scheme from the Tools menu such as Huge App:

Arduino IDE Choose Partition Scheme

However if you need the OTA (Over the Air) partition or need to store data that survives power off and also need more space than is available in the IDE schemes then you can tweak the partitions to change the space available in different parts of the flash storage. Partitions can be thought of as slices of a cake or pizza. You can make them larger or smaller but the overall space is the same.

Create Partitions

The partition schemes are stored as CSV files. They can be found in one of two places, depending on how you installed the Arduino IDE.

Arduino IDE installed from the Windows Store:

C > Users > *your-user-name* > Documents > ArduinoData > packages > esp32 > hardware > esp32 > 1.0.1 > tools > partitions

Arduino IDE installed from the Arduino website:

C > Users > *your-user-name* > AppData > Local > Arduino15  > packages > esp32 > hardware > esp32 > 1.0.1 > tools > partitions

They look like this when opened in Notepad

Min Spiffs Partition

Huge App Partition

You can see the min_spiffs partition.csv scheme has two app partitions (app0 and app1) of 0x1E0000. Using a Hex to Decimal online converter the 0x1E0000 hex number converts to 1966080 bytes hence the error message above  Sketch uses 2233498 bytes (113%) of program storage space. Maximum is 1966080 bytes

The huge_app partition scheme has only one app partition of 0x300000 which is 3145728 bytes. This is plenty for the application but there is nowhere to store the permanent data as app0 is overwritten every time the board is flashed.

ESP32 Hardware Library v1.0.5 New Partition System

The ESP32 Arduino Hardware Library release 1.0.5 brings with a new much easier way of uploading a custom Partition Scheme. The new partition file can be added to the same directory as the Sketch and are uploaded with the Sketch. Choose ‘Huge App’ from the Tools > Partition Scheme menu to make sure the Sketch will upload. The actual partition used will be the one uploaded.

Persistent Storage

I needed to add a new partition for saving computed faces from a face recognition application. The computed faces are stored in a part of the on-board flash that has to be set up in certain way. A new partition type is needed. I created a new partition scheme file like this:

Fr Partition

In this file I changed the size of the app0 partition to be 0x280000 which is 2621440 bytes. I also created a second partition called fr with 0xEF000 (978944 bytes) of space . This second partition is used by my application to store permanent data. I used the name, type and subtype from this code for fr_flash.h here

#define FR_FLASH_TYPE 32

You can download my partition file from here:

The offset of each partition should be the value of the previous offset plus the size of the previous partition. With SSDs and flash memory there are recommended sizes for partitioning disks. I had an error about offsets when I tried to create this using my own values and in the end I used HEX values from other examples to create my partitions. If someone knows the recommendations please let me know.

Adding the New Partition Scheme to the IDE

From v1.0.5 of the Arduino Hardware Library the instructions below are no longer needed. Just add a new partition named partitions.csv to the same directory as your Sketch. It won’t appear in the IDE tools menu but if you select ‘Huge App’ the Sketch will upload and use the new partitions.

Pre v1.0.5 instructions…

Once the new partition scheme file has been created you need to add a reference to it in the boards manager so it can be selected in the Arduino IDE. The boards.txt file is found in one of two places

Arduino IDE installed from the Windows Store:

C > Users > *your-user-name* > Documents > ArduinoData > packages > esp32 > hardware > esp32 > 1.0.1

Arduino IDE installed from the Arduino website:

C > Users > *your-user-name* > AppData > Local > Arduino15  > packages > esp32 > hardware > esp32 > 1.0.1

The boards.txt file can be edited in Notepad. Each definition is separated by a line like this: #########

I copied ESP Dev Board definition and changed the name and added three new lines for the new partition file. You could just add these lines to an existing definition if you prefer: Recognition (2621440 bytes with OTA)

You can copy and paste the definition below to create a new board if you have used my rzo partition definition file above.

############################################################## Zero One


rzo.serial.disableRTS=true -mfix-esp32-psram-cache-issue (2MB FLASH) OTA (Large APP) APP (3MB No OTA) SPIFFS (Large APPS with OTA) Fat Recognition (2621440 bytes with OTA) (WiFi/BT) (WiFi/BT) (WiFi/BT) (40MHz XTAL) (26MHz XTAL) (40MHz XTAL) (26MHz XTAL) (40MHz XTAL) (32Mb) (16Mb) (128Mb)

In the IDE the new scheme will be available for the new board or any board you add the new definition to:

Arduino IDE Custom Partition Scheme

Using the ESP32 Partition Manager

Since writing this article I found a couple of tools that might make working with the partitions easier: and for the Arduino IDE:


Why programmers use Hex:
Hex to Binary Converter:
Hex Calculator:
Partitioned Pizza Photo: Vita Marija Murenaite on Unsplash

23 Replies to “Partition Schemes in the Arduino IDE”

  1. Antonio says:


    i will try to use your board definition for a ESP32 CAM board but I have one question.

    How it is possible that OTa is enabled if you don’t have two partitions for OTA? and no space also?

    Thank you!

    1. WordBot says:

      You’re right (I think!) the partition should just be called

      Face Recognition (2621440 bytes)

      because there isn’t the OTA partition for uploading new sketches.

  2. kwluk717 says:


    I am new in ESP32-CAM, I have follow your project and successfully save permanent face information to flash. But may I know if there is some way I can ease and start over again ? Thank you very much.

    1. WordBot says:

      Great! This tutorial has a little Sketch that deletes all the faces under Deleting Faces From the Memory

      1. kwluk717 says:

        Oh, sorry that I overlook the code….

        However, I follow the delete face program, the output as below but when I upload again Camera WebServer. The image still not enrolled. I have try using the new partition (Faceetection) or Huge App but both have same result….Any idea ? Thank you.

        rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
        configsip: 0, SPIWP:0xee
        mode:DIO, clock div:1
        entry 0x400806a4
        E (1417) fr_flash: No ID Infomation
        Faces Read
        E (1418) fr_flash: No ID Infomation
        All Deleted

        1. WordBot says:

          It looks like there were no faces stored from the output above.

          Are you using the version 1.0.1 of the boards library?

          1. kwluk717 says:

            Yes, it is version 1.0.1. I try few more times to install delete face and cam web server prog. but still unable to enroll again… Maybe is there some way to clearup the whole partition instead ? Thx

            1. WordBot says:

              Which tutorial are you using to enroll faces? You don’t need to clear the partitions each time but if you want to use permanent faces you should only use the custom partition table.

              1. kwluk717 says:

                I uploaded the Camera WebServer example app to test with image enrollment, and tested also your tutorial of CameraWebServer Permanent after deleted the saved image tutorial uploaded. I excepted the first facedetected will enroll but both result show intrusion detected…. Therefore i believed the image was not successfully removed. Thank you.

                1. kwluk717 says:

                  I used the esptool with “erase_flash”, but still got “No Match Found” in serial monitor / “Intrusion detected” in the web UI for the both Camera Web Server or Camera Web Server Permanent….stuck here and don’t know why….

                2. WordBot says:

                  Hi, You shouldn’t need to erase anything. What happens if you follow the instructions here: to create a new partition type and then make a copy of the Camera Web Server example and make the changes. Can you enrol faces? IF that part works then you should be able to then upload the sketch in the second part (without deleting anything) and use those enrolled faces to trigger actions.

                  1. kwluk717 says:

                    Sorry to disturb you again I just have resolve the problem now. Your tutorial work perfectly. Thank you very much,

  3. Alok Shaw says:

    Hi, i am unable to understand: How to edit the board.txt. I copied and pasted the text as you said….But unable to get partition schema in Arduino ide.
    Can, you share the edited board.txt file

    1. WordBot says:

      Hi, Did you restart the IDE? It should work if you follow the steps.

  4. Rudab says:

    hello , i have the same problem as yours . how did you solve it ?

  5. sarah says:

    hi , if I increase the app0 size what else I have to change in the same partition table you create ?
    I tried increasing the app0 , when I plug the esp the sketch is upload but the esp continuously reset !

    1. WordBot says:

      It’s like a pizza, if you make one bit bigger another has to be smaller. They also have to have have the correct starting place. It’s something I don’t know fully.

    2. Giuly says:

      Hi sarah, I have the same problem when I tried increasing the app0. Did you solve the problem?

      1. WordBot says:

        Take a look at this.. it might help

  6. Alex Raboud says:

    Appreciate the breakdown here. This walked through the concepts nicely.

    One small correction you might want to make here:

    >From v1.0.5 of the Arduino Hardware Library the instructions below are no longer needed. Just add a new partition named partition.csv to the same directory as your Sketch.

    It is actually looking for a “partitions.csv” file (plural) as mentioned here:

    From a quick test, it won’t show up in the menu, but the partitions will be created properly.

    1. WordBot says:

      Thanks for pointing out the error. I’ve fixed it now and added a little more text.

  7. Miche says:

    Hi, I have some problems with the error “E (3848) fr_flash: Not found”, I tried to add partition file csv in the directory of the file arduino, also adding the partitions and the other things said in this page but I have the same error. How can I solve it? Also I cannot find the “fr_flash.h” library. Help me please. Thanks

    1. WordBot says:

      Hi, which tutorial are you following? Normally you need v1.0.4 or 1.0.5 of the ESP32 Hardware Library

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

scroll to top