How do flash drives and memory cards work

Cell phones and digital cameras rely on solid state drives like flash drives and memory cards to store data. Unlike hard disks, solid state drives do not have a spinning disk where data is stored magnetically. The data on solid state drives are stored in what are called flash memory.

Memory cards and USB Flash Drives

Memory cards are not like USB flash drives only because of the interface. There are additional electronics in USB flash drives which allow for the transfer of data from the storage to pass through the USB interface. In contrast, different memory cards have different types of interfaces to allow the access of data.

However, there is a big similarity in the way memory cards, and USB flash drives operate. Unlike hard disk drives, flash and memory drives have an intermediate controller which keeps track of the number of write cycles for each sector. This same firmware also tries to parcel out the data to different sectors and try to maintain equality concerning actual write cycles.

A very important consideration due to the nature of the solid state memory.

Solid State Memory versus hard disks

Hard disks move around a spindle, and an arm goes to a specific area (called a cylinder) to access the data on a sector. When the arm is unable to write data to a sector due to physical problems, then that area is considered a bad sector. On modern hard disks, there are extra sectors for this eventuality. The bad sector is marked, and one of the extra sectors is put into play. It does not matter that the new sector is not in the same cylinder. What matters is that the hard disk size stays the same.

Hard disks are designed to store the same amount of data from the moment it left the factory until the time it physically fails to spin, or work properly. At some point due to normal wear and tear, the disk will fail. Typically, this happens around five years after the disk is first used. However, signs of deterioration can appear as early as three years from purchase of a brand new disk.

For a solid state drive, the flash memory does not move. However, at some point, their magnetic storage properties will no longer be able to work, and writing can no longer be done. From the factory, tests are done, and the current state of technology has solid state drives capable of up to 100,000 write cycles. A write cycle is defined as an instance when data is written to a sector. It includes a clean wipe or a low-level format. This is also one reason why a low-level write is not usually done on a flash drive or a memory card.

As long as a sector is not over-written, it will contain the same information. To format a solid state drive, only a particular area is overwritten. This is the table which contains the information about a certain sector. The table tags a sector as empty and can be overwritten. When data is written to a sector, the table is also updated to reflect that the sector has data, and a counter is also incremented. The firmware takes a look at the table and writes to those sectors which are “empty” and has the lowest count for “writes.” In this way, the writing is spread over all the sectors over the drive’s lifetime.

This extra step of looking up a table is imperceptible because it is faster to write to a memory card or flash drive compared to a hard disk. What is slow, however, is the USB or the memory card interface.

Formatting Your Flash Drive

When formatting a flash drive, typically, only the firmware’s table is updated. The entries are “emptied,” and the sector count is incremented. If you want to do a “hard” low-level format to map bad sectors, you can also do so. However, due to the size of the memory card or the flash drive, it will take a long time to do. When you do a low-level format, each sector is overwritten with “zeros.” Writing that a large amount of data is time-consuming.

Data Recovery

This is why it is easier to recover data from a reformatted flash drive or memory card. When you use your cell phone camera to take pictures, these are all saved on your phone or your microSD storage device.

When you make a mistake and reformat the microSD drive, the operating system will read the flash drive’s table, and it will tell you that the sectors are empty. However, with a low-level read, it is possible to recover the data on the sectors. You only have to make use of a recovery program on a computer to recover the data on the microSD card’s sectors. When you go to a cell phone repair center and have them recover your data, some other data may be recovered. All data on the drive will be recovered, but not all will be complete files. Some recovery programs check if a file is complete, while most will not bother.

Tough but Still Fragile

Although cards are designed to be robust and tough, there will be instances when these will fail. In most instances, when you get your phone wet, the electronics in the memory cards will not be damaged. However, there are instances when the data gets fried, due to overheating or a short circuit. In such cases, there is only a small chance that your data can be recovered.

If you want your cell phone pictures safe even if something happens to your phone or the microSD, it is better if you have the synchronization between your phone’s photos and Google Photos turned on. This means that when you take pictures, these will be uploaded to Google Photos as soon as you have a WiFi connection.

Flash drives and memory cards have a common root in development. They do not have any moving parts and hence do not fail that easily. However, these can still be destroyed by mishandling or actual damage to the drives or internal memory elements.

Leave a Reply

Your email address will not be published. Required fields are marked *


Comment Should not be empty