2

I have a very old 256 MB SD card (purchased around 2004).

The SD card is still working, but some old photos are missing due to a possible unintentional format action on my digital camera.

Is there any way to recover the data on it?

mentallurg
  • 12,418
  • 5
  • 36
  • 50
AGamePlayer
  • 123
  • 4

1 Answers1

1

I think the format operation is almost certainly a red herring here.

To understand what likely happened here, it helps to understand the electronics behind flash cells. The flash cells inside a flash card are typically based on the floating-gate MOSFET principle.

A MOSFET typically has three connections: a gate, a drain, and a source.

Diagram of a MOSFET symbol showing gate, drain, and source.

An electric current is allowed to flow from the drain to the source once the gate voltage exceeds the source voltage by a certain amount known as the gate threshold, or Vgs(th) for short. A MOSFET's gate is like a tiny capacitor. A charge builds up inside the gate, and that is what ultimately controls whether or not a current can be conducted across the drain and source.

As such, if you connect a voltage to the gate and build up a charge, then disconnect the gate so it is left floating (i.e. unconnected to anything), the charge at the gate doesn't have anywhere to go and the MOSFET continues to operate as if you had the gate connected to a voltage source. If you later connect the gate back to 0V (ground), the charge on the gate can dissipate and the MOSFET turns off. If you disconnect the gate after discharging it, there's no way for charge to build back up on the gate so it doesn't turn on again.

Flash cells exploit this as a kind of memory. A flash cell is written to by connecting the gate to either a positive voltage or ground, then disconnecting the gate again. A flash cell is read by seeing if the MOSFET "pulls" a voltage down towards ground. I put together an interactive simulation for you to explore this:

Simulation schematic

The capacitor in this simulation represents the charge being stored on the MOSFET gate, since Falstad's transistor model does not include gate capacitance or charge.

To read the cell, click and hold on the switch marked "read". The value read from the cell (1 or 0) will appear on the right. To write to the cell, click on the input on the left to set it to 1 or 0, then press the "write" switch.

When the "read" switch is pressed, the 10k resistor and the MOSFET form a voltage divider. If the MOSFET gate is charged, the MOSFET is "on", so it has relatively low resistance. This pulls the output voltage down towards 0V. If the MOSFET gate is not charged, the MOSFET is "off", so it has relatively high resistance. The 10k resistor pulls the voltage up towards 5V.

By inverting this output (i.e. 0V out means 1, 5V out means 0) you get the original value (1 or 0) written into the cell. In practice this inversion is often done at write time instead of read time, i.e. you write a write a 0 bit by charging the gate, and write a 1 bit by depleting the gate charge.

The problem is that a MOSFET's gate is not perfectly insulated. Even if you disconnect it completely, a small amount of charge can "leak" in or out of the gate over a long period of time. After a while, a charged gate can lose so much charge that the MOSFET no longer switches on strongly enough to pull down the voltage when read, so a stored 1 degrades into a 0 (or the other way around, depending on the exact design).

Flash cells are specially designed to minimise gate charge leakage in the MOSFETs, but they're still not perfect. A tiny amount of leakage current is always present, in part due to the laws of quantum physics. This means that flash cells will not retain their written data over very long periods of time.

Higher end flash storage systems like SSDs include an internal scrubbing process that periodically reads data from cells and writes it back to the cell to "replenish" the charge state. This prevents degradation over time. However, SD cards and USB flash drives do not have this feature, and they are not suitable for archival purposes.

The degradation process is not deterministic and typically follows a half-life pattern, where more and more cells start to degrade over longer periods of time. You typically expect to see degradation after 1-5 years, depending on the flash cell technology and the specific design.

Unfortunately for you, the process is not reversible. Once the charge in a flash cell degrades, you can't tell if it was supposed to be storing a 0 or a 1. For some data formats (e.g. text) you may be able to recover from some light data corruption by inferring which bits were likely corrupted, but for JPEG this is nearly impossible.

Polynomial
  • 135,049
  • 43
  • 306
  • 382
  • Thanks very much for a such detailed explanation. So, may I regard all the software that declares can recover my data as a waste of money? – AGamePlayer Oct 10 '22 at 12:40
  • 1
    @AGamePlayer That software can recover lost data in the "the computer marked the file as deleted in the file table but didn't destroy any of the actual data itself" category of things, but once the data is damaged or destroyed you can't do much, and the software certainly won't resolve it. – Polynomial Oct 10 '22 at 22:25