Why deleted files in SD card keep coming back?

Have you ever deleted files from your SD card, only to find them mysteriously reappear later? This strange phenomenon can be frustrating and concerning, especially if you thought sensitive information was securely erased. In this article, we’ll explain why deleted files keep coming back on SD cards, even after you empty the recycle bin. We’ll cover how deleting files works on different devices, the quirks of flash memory cards, and when you truly need to worry about deleted files reappearing. Read on to finally understand this tech mystery, and learn how to stop deleted files from continuously popping up.

How Deleting Works

When you delete a file from an SD card on your computer, the file isn’t actually erased from the card right away. Instead, the reference to the file’s data is removed from the card’s File Allocation Table (FAT). The FAT keeps track of which clusters on the disk contain each file’s data. By removing the file’s entry in the FAT, the operating system is telling the card that the space taken up by that file can be overwritten with new data.

However, until new data overwrites the deleted file’s clusters, the file data itself still remains on the SD card. This is why it’s often possible to recover “deleted” files using data recovery software. The data is still there, even though the FAT says it’s okay to write over it. That is the key difference between deleting a file and permanently erasing it – with deletion, the data remains until overwritten.

To permanently erase files from an SD card, there needs to be a secure delete process that overwrites the file’s data clusters with meaningless gibberish. Standard deletion through your operating system’s file manager is not secure erasure. So recovering deleted files from SD cards is very possible as long as the original data clusters haven’t been overwritten.

File Allocation Table

The File Allocation Table (FAT) is a system that keeps track of used and unused memory blocks on storage devices like SD cards and hard drives 1. When a file is deleted on a device using FAT, the file’s blocks are not immediately erased. Instead, the FAT marks those blocks as available for new data 2. The file appears deleted in the file system but physically remains on the device until those blocks are overwritten.

This is why deleted files can be recovered – the data itself was never erased, just the FAT marking telling the OS it’s available space. As long as those memory blocks aren’t overwritten with new data, the original deleted file’s contents remain intact and recoverable. The FAT plays a key role by keeping track of used/unused blocks, enabling file recovery until the OS or other programs overwrite the “deleted” data.

Recovery Software

Recovery software provides a way to recover deleted files from storage devices like hard drives, USB drives, and SD cards. These programs work by scanning the drive and looking for files that have been marked as deleted in the file allocation table, but that still have data present in unused blocks on the drive.

When a file is deleted, typically only the entry in the file allocation table is removed, marking the space occupied by that file as available for new data. The actual contents of the file remain on the drive in those blocks until they are overwritten by new data (Source: https://www.ccleaner.com/recuva). Recovery software leverages this fact to scan for files that have been deleted but still have recoverable data on the drive.

Popular recovery programs like Recuva, EaseUS, Disk Drill, and others provide an easy way for end users to quickly scan any drive and restore accidentally deleted files. The software scans the drive, identifies files marked as deleted, retrieves their data from unused blocks, and copies the files to another safe location to avoid overwriting them (Source: https://www.lifewire.com/free-data-recovery-software-tools-2622893). Advanced settings even allow recovery from formatted drives in some cases.

Overall, recovery software leverages the disconnect between file allocation tables and unused data blocks to resurrect deleted files. This provides a safety net for end users against accidental deletion or data loss. However, recovery becomes less likely the more a drive is reused over time.

Flash Memory Quirks

Flash memory has some peculiar characteristics that can lead to previously deleted files persisting even after deletion. Unlike magnetic hard drives, flash memory cannot directly overwrite existing data – in order to write new data, the existing data blocks must first be erased (set to all 1s) before new data can be written (Wikipedia, 2023).

Additionally, flash memory uses a process called wear leveling to extend the lifespan of the memory. This means that data is not necessarily written to the same physical location each time, but rather spread around to different locations to evenly distribute writes. When a file is deleted, only the file allocation table is updated, but the actual data blocks containing the file contents may remain intact until they are overwritten by new data (TechTarget, 2023).

Due to wear leveling and the inability to directly overwrite data, remnants of deleted files may remain in unused blocks of flash memory until the operating system reuses those blocks. This is why previously deleted files can reappear in flash memory cards and drives (Flash Memory Summit, 2023).

File Fragmentation

When a file is deleted on an SD card, it may become fragmented across different blocks of storage. File fragmentation occurs when there is not enough contiguous space available to store the entire file, so it gets split into fragments and written across disconnected portions of the drive. Even though the file allocation table marks the fragments as deleted, the actual data remains on the drive until it gets overwritten by new files.

Fortunately, data recovery tools can scan the drive and piece together fragmented file segments. The software searches for file signatures — specific byte patterns associated with certain file types like JPEGs or MP3s — and uses them to identify fragments of deleted files. It then reconstructs the file by putting all the fragments back in the proper order based on the file system metadata. As long as the fragments have not yet been overwritten, fragmented files can often be successfully recovered.

According to Wondershare, their File Recovery software utilizes advanced algorithms to recover data from fragmented files and retrieve as much of the original data as possible. When recovering a fragmented SD card, it’s best to stop using the device immediately to prevent overwriting deleted data, then attempt recovery with professional software.

Quick Format

A quick format, as the name implies, formats a storage device much faster than a full format. However, it does not actually erase all the data on the device. A quick format simply empties the file allocation table (FAT) and marks all existing files as deleted. The actual contents of the storage blocks containing deleted files remain intact.

With a quick format, only the file system information telling the operating system where files are located is erased. The deleted files themselves still reside on the storage device, though they are no longer accessible through normal means. This is why previously deleted files can often be recovered – the actual data is still there until it gets overwritten by new data. For more details, refer to this source: Quick Format vs. Full Format: How Are They Different?

SD Cards and Wear-Leveling

SD cards utilize wear-leveling algorithms to extend the lifespan of the memory by evenly distributing writes across all the cells. This prevents any single cell from wearing out prematurely. As explained on the Delkin blog, “One essential algorithm makes wear leveling SD cards last even longer than their original design allows for: wear leveling. Wear leveling ensures that writes are evenly distributed across all the program-erase cycles of the SD card to prevent any cell from wearing out ahead of all the rest.”

A consequence of this constant redistribution of data is that deleted files can become scattered across the memory, making recovery more difficult. As noted in an article on Medium, “Wear leveling can scatter deleted files across multiple blocks, and the TRIM command can quickly erase data. This makes data recovery from SSDs much more difficult than from traditional spinning hard drives.”

In summary, the frequent reorganization of data by wear leveling algorithms means traces of deleted files are moved around and can be challenging to recover with standard methods.

Secure Deletion

To securely erase files from an SD card to prevent recovery, you need to overwrite the data. Simply deleting files or formatting the card is not sufficient, as data remnants can still exist. Here are a few methods to securely erase an SD card on Windows and Android:

On Windows, you can use the Diskpart command line utility to clean the disk. Open the Command Prompt as Administrator, type “diskpart”, then “list disk” to identify your SD card’s disk number. Then run “select disk X” (replace X with your disk number), followed by “clean”. This will overwrite all data on the disk with zeros (https://recoverit.wondershare.com/format-sd-card/securely-erase-sd-card.html).

Third party tools like EaseUS BitWiper can also securely erase SD cards by overwriting data. They provide more options than Diskpart for erase methods. BitWiper supports algorithms like DoD 5220.22-M to overwrite data multiple times (https://toolbox.easeus.com/hdd-wipe/erase-sd-card.html).

On Android, use the ‘Erase SD card’ option under Storage settings. This will format the card and overwrite data to prevent recovery. You can also install an app like SD Card Eraser to wipe cards before removal.

Conclusion

In summary, deleted files may reappear in SD cards for several reasons. The file allocation table that keeps track of used and free space can become corrupted. Recovery software can restore files even after deletion. The way flash memory works can leave file fragments scattered. Quick formatting doesn’t fully erase data. Wear-leveling shuffling blocks around can bring back deleted files. Secure deletion using multiple overwrites or physical destruction is the only guaranteed way to permanently erase files.

The key points are:

  • The FAT can get corrupted causing files to reappear.
  • Data recovery software can bring back deleted files.
  • Flash memory operation leaves file fragments.
  • Quick formatting doesn’t overwrite data.
  • Wear-leveling moves data around.
  • Secure deletion is needed to fully erase files.

In the end, recovering deleted files is often possible with SD cards unless special techniques are used to thoroughly delete data. Understanding the reasons behind reappearing files can help users better manage their SD card contents.