SD Card filesystem poblem

I guess that the flash memory was not enough for SdFat buffers, everything crashed in a reset loop...

Flash use will not cause a crash in a reset loop. If you are that close to running out of RAM, you will likely have a problem if you log data and run gprs at the same time. A pin change interrupt in SoftwareSerial can cause a stack overflow while an SdFat function like remove() is executing.

If possible check the amount of free stack by adding this include:

#include <SdFatUtil.h>

And this print in setup()

  Serial.println(FreeRam());

You need 200-300 bytes of free RAM in addition to any you allocate in functions.

I looked at your SD module and these often fail.

The problem is that these modules don't use proper level shifters on MOSI, SCK, and CS. These signals should be converted from 5V to 3.3V with an IC based level shifter. Most SD cards are not designed to accept 5V signals.

Too bad you can't use CRC on the SD to check for data transfer errors. You can check for any detected SD problem like this:

if (sd.card()->errorCode()) {
  // print SD I/O error code
  Serial.println(sd.card()->errorCode(), HEX);
}

Here are typical SD modules with a level shifter in addition to a 3.3V regulator

http://www.pjrc.com/teensy/sd_adaptor.html