if (!vol.format(&ram, 256, 4, 1)) {
Serial.println(F("format fail"));
return;
}
This says use 256 blocks of ram, allocate 4 blocks for directory, and cluster size of 1 block.
You probably should just use the defaults.
if (!vol.format(&ram)) {
Serial.println(F("format fail"));
return;
}
This will use all blocks, allocate at least four blocks for directory, and use a cluster size of one.