“Mount failed” usually means the file system was never formatted or the partition scheme has no space for it.
What the message means
The flash holds a partition table. If it has no SPIFFS or LittleFS partition, or the partition is blank, mounting fails.
Fix it in this order
- Start the file system with the format-on-fail option, for example LittleFS.begin(true), for the first run.
- In the Arduino IDE choose a Partition Scheme that includes SPIFFS or LittleFS.
- Match the library to the partition type. A SPIFFS partition needs the SPIFFS library; the LittleFS library needs LittleFS.
- Upload the data folder with the upload tool that matches your IDE version.
- Check the file size against the partition size.
- Open the file with the full path starting with /.
Why it happens
The file system mount fails when the partition scheme has no space for it, when the board was never formatted, or when the library and the file system type do not match.
Choose a partition scheme that includes SPIFFS or LittleFS, and call begin(true) so a failed mount formats the file system once.
if (!LittleFS.begin(true)) { // true: format on failure
Serial.println("mount failed");
}
Example sketch: change pins and values for your own wiring. It has not been bench-tested on your hardware.
If you see this, do this
| You see | Do this |
|---|---|
| Fails only the first time | Format on fail. |
| Still fails | Wrong partition scheme. |
Related
invalid header, wrong boot mode.
Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.
Why this happens
SPIFFS and LittleFS are file systems that live in a flash partition set by the partition table. ‘Mount failed’ means the code could not find a usable file system in that partition. Three situations cause it: no partition of that type exists (the partition scheme was chosen without one), the partition has never been formatted, or the partition holds a file system of the other type.
The default partition table calls the data partition spiffs even when it holds LittleFS, so a name alone does not tell you which type is stored. An image uploaded by one tool and mounted by code expecting the other fails in the same way as an empty partition.
How to confirm the cause
- In the IDE’s Tools menu, read the Partition Scheme. Schemes labelled ‘No FS’ or with a very large app and no data have no space for files.
- Read the serial boot log. A line naming the file system and ‘mount failed’ proves it is the mount, not your own code.
- Print
LittleFS.totalBytes()andusedBytes()after a successful mount; zero or odd values show a wrong partition. - Check that the library you include matches the type you uploaded (LittleFS.h or SPIFFS.h).
- Check the flash size setting against the real chip.
Worked example
Mount LittleFS, with formatting on failure only during first set-up. Formatting erases the files in that partition.
#include <LittleFS.h>
void setup() {
Serial.begin(115200);
if (!LittleFS.begin(true)) { // true = format if mount fails
Serial.println("mount failed");
return;
}
Serial.printf("used %u of %u bytes\n",
LittleFS.usedBytes(), LittleFS.totalBytes());
}Common mistakes
- Leaving formatOnFail as true in a product, which can wipe data after a fault.
- Uploading a SPIFFS image and mounting with LittleFS.
- Opening a path without the leading slash.
- Choosing a partition scheme to gain program space and losing the data area.
- Using an uploader plugin written for an older core.
If this did not fix it
- Flash size in the IDE does not match the chip, so the partitions are in the wrong place.
- Power dips during writing that damaged the file system.
- A custom partitions.csv that has no data partition or the wrong sub-type.
- The data folder is empty, so the upload produces an unusable image.