Format / check SD card using Arduino

I had an issue: because of the power fluctuation and/or a thunderstorm, the SD card that I am using with ESP8266 was damaged: some file names became unreadable (FAT table broken?) and ESP couldn't do anything about these files which caused some issues.

I inserted the card to my computer and made a "Tools -> Error checking -> Check". The card was fixed and everything works fine since then.

Can you please advise if it is possible to avoid such kind of errors?

When I am using Arduino,

  1. Is there a way to figure out that the card is partially damaged (I think it's called checking the fat table)?
  2. Is there any way to make a card check/fix like the Windows does?
  3. Is there a library that can make a quick format?