A good open source utility to recover from damaged or corrupted camera memory cards (be they SD cards or MMC cards or other flash formats) is photorec, which for Debian and Ubuntu is in the package testdisk

A tutorial on how to use it is here,

although all you do is

a) plug your card in to your card reader

b) run as root from a shell (eg sudo does this)

 photorec

and answer the questions.

My tips for answering the questions are, for a corrupt card used with a Canon EOS 5D are:

Partition type: None

File System: Other (because it's some kind of FAT file system, but all variants of FAT are included in Other)

I saved the files to my home directory. photorec

photorec actually created folders and saved the data in those folders.

An 8 GB card took about 30 minutes to process.

The point of this article is to help people find this free software, because searching for "undelete SD card" or even "undelete SD card open source", or "undelete camera card open source" leads only to commercial packages, which is annoying. Searching for "data recovery ubuntu" or "data recover linux" works better. I've used this software twice, once for an undelete and once for a corrupt card. Very happy.