Note that this answer isn't technically accurate, I am nearly trying to explain certain mechanisms!
Some cameras use the equivalent of TRIM which you have heard of in relation to SSD drives. TRIM is often misunderstood and confused for 'erased' as in actually overwritten.
What the SD Card ERASE command does is inform the card's firmware about ranges of LBA sectors it no longer needs. This is useful for the card as it needs erased pages to write data. Erasing is slow, so if the card knows about stale blocks it can erase while being idle, it helps the card to maintain speed when it's asked to store data.
The card responds to the ERASE by sort of 'flagging' these LBA ranges that were passed on by the ERASE command, and when we try to read those LBA sectors it simply returns zero filled sectors without even reading them. It even does so if data was not actually yet erased! So, certain cameras, I know many Sony cameras do send an erase command to the card when you use for format option.
This cuts of the option of recovering data using file recovery software. However if you do not allow the card firmware to perform background tasks, data may still be recoverable by a lab as they have the hardware and software to bypass the controller. To reconstruct data the controller is emulated, however this is labor and time intensive and therefor quite expensive, say $400+.
Now say you inspect the card using a hex editor, for example HxD and you find the card was actually not filled with zeros for for the largest part, or you simply know your camera does not issue an ERASE command?
I have seen cases that were kind of perfect storms that prevented file recovery software, free, open source or commercial from recovering anything while data was present. For example I have helped someone achieve at least partial recovery after this scenario:
- Canon RAW files were all corrupt apart from 2 or 3.
- Recovery was attempted using Recuva but this only resulted in the same corrupt files being recovered.
- He was the given the advise to format the drive
- Now files weren't even detected anymore
- PhotoRec was tried, it only recovered the photos that were initially undamaged.
He then imaged the card (sector-by-sector image) and uploaded it somewhere where I could grab it. Using my home-brew tool I scanned the card (image). Nothing was detected however entropy map showed, proved there was high entropy data. So then my analysis was:
- Somehow format removed all references to files, so files may have been in the root folder.
- raw scans using PhotoRec and such failed due to the files being corrupt in the first place, hence they could not be detected by magic bytes (signature).
I told owner of the card highest achievable was trying to extract full resolution JPEGs from the corrupt RAW Canon files which I then did by adapting my home-brew tool to this specific situation: Normally raw scanners (like my tool and PhotoRec) preferably look for signatures at cluster boundaries and if clustersize is unknown at sector boundaries. As embedded JPEG in raw photos are not sector aligned they weren't detected. I made my tool then:
- Read good chunk of data
- Evaluate if entropy was 'jpeggy'
- If so scan entire chunk for JPEG signature, not just at sector boundaries
- Check if signature was not false positive: FF D8 signature is followed by a marker, check size of marker so we know where to look for next marker. If no marker there then probably fp.
- If not, did it meet minimum resolution requirement (to skip thumbnails)
- If so, recover the JPEG.
For all but a few of the corrupt RAW Canon photos a full res JPEG was recovered. Owner was happy and so was I because these type of cases are very rewarding (not meant in monetary sense)
Just to illustrate that if data can not be recovered it is not per se unrecoverable, and it does not per se require chip-off recovery.