Sticky problem on SD card

I have a problem on one my application on SD card.
Actually I’m using a threat to mount and unmount filesystem.
Even if I use interrupt to check when sd card is extracted many time file system is corrupted.
I’m using this card for datalogging some datas, if I mount and unmount filesytem every time I need to write on my file is it correct? Time for recording is 20 sec as minimum.
Second thing, if I use that way, in case of power disconnection during sd writing, is file corrupted or not??

Pls suggest me best way to solve this problem.

Regards

@ Matteo82 -

[quote]
if I mount and unmount filesytem every time I need to write on my file is it correct? [/quote]

Not correct. You don’t need to do that. If the SD is mounted then does not matter how many time writing or reading after that.

In case you want to re - mount an SD again, if you are using blank NETMF code, then you have to call Dispose(). But you using gadgeteer, I think it does it automatically.

Depends on how your program is. Using volume[0].FlushAll() it will flush written data to SD without closing handle.

Please tell the device and show code you are using.