~/blog
/
technology
/
how-deleted-files-are-recovered
Technology
Data Recovery
// 2026-09-13
~ 16 min read
THE SECRET OF FILES WE DELETE BUT NEVER TRULY ERASE
Suppose an old hard drive — forgotten in a storage room for years — lands in the hands of a data recovery specialist. The owner is certain everything was deleted: photos, documents, personal files, everything ever stored on it. But the examination tells a different story. Most file names no longer appear anywhere in the system, yet a significant portion of the photos and documents are still extracted from seemingly empty space. The problem isn't the Delete button — it's that we confuse "the file disappeared from the OS view" with "the data was physically destroyed."
#
What We Think Delete Does vs. What Actually Happens
Our mental model of deletion is usually this:
file → Delete → complete destruction
But on many storage devices, what actually happens in the first moment looks more like this:
file → address deleted or released → space declared reusable
The data may still be sitting somewhere on the storage media. The operating system simply no longer considers it an active file. This single difference is the entire foundation of data recovery.
#
First, an Important Distinction: The Recycle Bin Is Not Permanent Deletion
When you press Delete in Windows or other graphical environments, the file may first move to the Recycle Bin or Trash. In that case, even the file's management records are usually preserved — "recovering" it just means putting it back from the trash.
The real subject of this article begins when the Recycle Bin has been emptied, Shift + Delete was used, or a program deleted the file directly. Now the file leaves the OS's normal listing — but whether its physical content is actually gone is a completely separate question.
R
Recycle Bin / Trash
Moved elsewhere, still managed — recovery chance: very high
D
Permanent File-System Delete
File record freed or invalidated — depends on media type and rewriting
★
Overwrite / Sanitize / Crypto Erase
Access to previous content deliberately destroyed — nearly impossible to recover
#
Picture Memory as a Library
Imagine a large library. Every book sits on a shelf, and its shelf number is recorded in a catalog. To find a book, the librarian first checks the catalog, then follows the recorded address to the right shelf.
Now — what happens if we remove a book's card from the catalog? The librarian no longer has the normal path to it, but the book may still be sitting on the shelf. That shelf slot is simply considered "free" from now on, and the librarian is allowed to put another book in the same spot.
1
Book on Shelf — card exists in catalog
2
Card Removed — delete happens here
3
Book Still There — until another book takes the slot
The file system plays exactly the role of that catalog. For every file it keeps the name, size, timestamps, permissions, and the location of the file's data blocks. In many file systems, deleting a file first changes just this management structure and declares the file's space reusable. Until new data is written over that space, part of the old content may still be readable.
#
What Exactly Does the File System Keep Track Of?
At its lowest level, a hard drive or SSD is just a huge set of storage units. What turns those units into "files" is the file system. In Windows NTFS, file information lives in a structure called the Master File Table (MFT). In Linux ext-family file systems, inodes hold much of the file's metadata. FAT has its own cluster allocation table.
Before Deletion
filename → metadata record → data blocks
After Deletion
record = freed/invalid · blocks = reusable · content = maybe still there
This is why two deleted files are not in the same situation. One may still have an almost-complete management record showing its name, size, and the location of all its parts. From the other, perhaps only raw fragments remain with no known name or path.
#
How Do Recovery Tools Actually Find Files?
Recovery software typically follows two main paths:
Path 1: File-System Traces
- Read surviving MFT / inode / FAT records
- Locate the file's blocks from metadata
- Best case: name, folder, size and dates come back too
Path 2: File Carving
- Scan raw space for known signatures
- No reliance on names or folders
- Carves files out of the raw byte stream
Path 1 is like finding an old library card in the archive: the official catalog no longer lists the book, but there's still enough information to reach the shelf. Tools like The Sleuth Kit and Autopsy are built exactly for this kind of disk-image analysis and file-system forensics.
Path 2 — File Carving — kicks in when the metadata is gone. Many formats start with a recognizable signature. A JPEG file, for example, usually begins with these three bytes:
start: FF D8 FF | end: FF D9
A recovery program can search for a probable JPEG start, validate its internal structure, and walk forward until the end marker. That's carving: pulling a file out of a huge, unindexed stream of data.
#
A Small Experiment in Python
To see the core idea in action, we can write a very simple program that searches a raw file for the first JPEG image. This is not professional recovery software, and you should never run it directly on a disk holding important data — experiment only on a copy or a dummy file like memory.bin.
from pathlib import Path
JPEG_START = b"\xff\xd8\xff"
JPEG_END = b"\xff\xd9"
raw_data = Path("memory.bin").read_bytes()
start = raw_data.find(JPEG_START)
if start == -1:
raise SystemExit("No probable JPEG start found.")
end = raw_data.find(JPEG_END, start + len(JPEG_START))
if end == -1:
raise SystemExit("Start found, but no end marker.")
recovered = raw_data[start : end + len(JPEG_END)]
Path("recovered.jpg").write_bytes(recovered)
print("A probable JPEG was extracted.")
print("data start:", start, "| size:", len(recovered), "bytes")
1
Read — the entire raw data
2
Search — for the JPEG start signature
3
Find — the first end marker after it
4
Write — the bytes between into a new file
This simplicity has serious limits: a byte sequence can accidentally look like a JPEG signature. The original file may be fragmented so its parts aren't contiguous. Data resembling the end marker may appear inside the image itself, or the file may be incomplete. Professional tools check the format's internal structure, section lengths, the file system, block boundaries, and many other signals — not just signatures.
#
Why Do Some Files Return Perfect and Others Broken?
Recovery has no binary outcome. The result can be one of several states:
1
Fully Intact
File returns healthy, with its original name and folder
2
Healthy but Anonymous
Content survives; name becomes something like recup_00123.jpg
3
Half-Rendered
Only part of the photo shows; the rest is corrupted or gray
4
Hollow Document
Document extracted, but some pages or embedded objects are lost
5
Meaningless Fragments
Only unusable pieces of data remain
★
Nothing
No usable data can be found at all
The single most important factor is overwriting. Once the file system declares a deleted file's space free, new data can occupy those blocks. Even a small overwritten section can be a header, an internal table, a compressed archive's index, or a critical part of an image — enough to make the whole file unusable.
The second factor is fragmentation. If a file was stored in several separate places on the disk and the linking information is lost, simple carving may only find the first piece. Recovering videos, archives, and complex documents is much harder in this situation.
Encryption is decisive too. If data remains on an encrypted disk but the key is unavailable, extracting raw bytes does not produce readable content.
#
HDD and SSD Do Not Tell the Same Story
Much of our folklore about file recovery comes from the era of magnetic hard drives. On an HDD, the system can select a deleted file's sectors for rewriting, but until that happens the previous content usually remains in place. That's why quickly powering off a device can preserve recovery chances.
An SSD behaves far more complexly. NAND memory writes data in Pages, but erasure happens in much larger units called Blocks. The SSD controller also maps the OS's logical addresses to physical locations through a layer called the Flash Translation Layer (FTL), while Wear Leveling and Garbage Collection constantly shuffle data around.
This is where TRIM enters. Through the TRIM command, the OS tells the SSD that certain logical ranges no longer contain needed data. The controller can then mark those pages invalid and set them aside during Garbage Collection, or erase the whole block.
1
Delete — user removes the file
2
TRIM — OS notifies the SSD
3
Mark Invalid — controller flags the pages
4
Garbage Collection — blocks erased for reuse
HDD
Magnetic sectors
- Data usually stays until overwritten
- Carving usually works better without rewrite
- Full overwrite can be an effective Clear
SSD
NAND pages & blocks + controller
- TRIM may quickly pull data out of reach
- After TRIM, carving chances drop sharply
- Sanitize / Secure Erase / Crypto Erase are the right tools
ⓘ
Important nuance: TRIM doesn't necessarily zero every physical cell at that exact moment — the timing and method of physical erasure depend on the OS, interface, controller, firmware, and Garbage Collection state. But the SSD may return zeros or invalid data for TRIMmed addresses, making ordinary software recovery impossible very quickly. The precise statement is: once TRIM and controller cleanup have been applied to a file's range, recovery chances usually collapse — sometimes to practically zero.
#
What About Flash Drives, Memory Cards, Phones, and the Cloud?
USB flash drives and memory cards also use flash memory, but their behavior depends on their controller, file system, and support for deletion commands. You can't automatically extend an internal SSD's verdict to every flash device.
On modern phones, device encryption, flash memory, OS-level storage management, and key destruction can make direct recovery extremely difficult. On the other hand, a copy of the photo may survive in a Recently Deleted folder, a backup, a messaging app, cloud storage, or on another device entirely. What the user sees as "one file" is often several copies across several systems.
In cloud services, too, Delete doesn't necessarily mean every version vanishes instantly. Trash, Version History, Snapshots, Backups, and service retention policies can preserve copies for a while — though ordinary users can't always reach them, and every service differs.
#
You Deleted a File by Accident — Now What?
The most important rule: stop writing new data. Every download, installation, update, file copy — even normal system activity — can consume the freed space.
1
Stop Using the Drive — detach it, or power off if it's the system drive
2
Check Trash — Recycle Bin / Trash / Recently Deleted
3
Check Backups & Cloud — File History, Time Machine, snapshots
4
Never Install Recovery Tools on That Drive — installing can overwrite the very space you need
5
Recover to a Different Drive — never save back onto the same media
6
For Sensitive Data, Image First — work on a bit-by-bit copy, keep the original untouched
7
Clicking or Dropping Drive? Stop. — mechanical failure needs a professional lab
#
What If We Want the File to Be Truly Unrecoverable?
Now Delete is not enough. Even a Quick Format doesn't necessarily erase the whole media — it may just rebuild the management structures. NIST SP 800-88 Revision 2 defines three overall levels of media sanitization:
C
Clear
Standard logical wiping, suitable for reuse at lower risk levels
P
Purge
Stronger techniques defeating even advanced lab recovery — Crypto Erase can qualify
★
Destroy
Physical destruction of the media so it can no longer be used
For an HDD, overwriting the entire addressable space can be an effective Clear in most ordinary scenarios. For an SSD, rewriting a file many times — or even the apparently empty space — is a poor guarantee: Wear Leveling and Over-Provisioned space may mean some physical cells are never rewritten through the normal OS path. On these drives, use the device's own Sanitize, Secure Erase, or Crypto Erase features and the manufacturer's guidance.
Full-disk encryption from day one is a huge advantage: if all data is always stored encrypted with a strong key, and Crypto Erase reliably destroys that key, whatever remains is unintelligible without it. Note, though, that encryption whose key still lives in a backup, a user account, or another chip is not complete sanitization.
#
Five Myths About Deleted Files
Myth 1
- "Every deleted file is recoverable"
- Overwrite, TRIM, damage, lost keys say no
Myth 2
- "Delete zeroes all the bytes"
- Usually only metadata changes first
Myth 3
- "Format always destroys data"
- Quick Format mostly rebuilds structures
Myth 4
- "You must overwrite dozens of times"
- No universal magic number exists
Myth 5
- "TRIM instantly erases all cells"
- Physical erasure timing varies — but access is cut fast
On Myth 4 specifically: the method must match the media — HDD, SSD, firmware capabilities, and sensitivity level. Multiple overwrite passes on an SSD just add wear without ever touching the hidden cells.
#
Deleting Is Not Destroying
Two sentences that sound similar but mean very different things:
"The OS no longer shows the file"
A statement about visibility
"The file's data no longer exists on any recoverable part"
A statement about destruction
In many cases, pressing Delete is like removing a book's name from the library catalog — not burning the book. That difference is both hopeful and alarming: hopeful, because a photo or document we deleted by mistake may still come back; alarming, because selling or discarding a drive without proper sanitization can hand our private data to the next person who owns it.
Deleted files don't come "back to life" — they sometimes never died in the first place. Only the official path to them was lost. Recovery tools rebuild that path, or piece the remaining fragments together by reading the raw data directly.
Delete means the system has forgotten the file;
Sanitize means the data is gone
beyond anyone's ability to reach it.