SSD Data Life: What Happens to Stored Files
In this article
When you delete a file from an SSD, the data isn't immediately erased — it's marked as free space, and the SSD's controller may later physically erase it during garbage collection or TRIM commands. Unlike a hard drive, an SSD stores data in NAND flash cells that wear out with each write, so the drive actively manages where data lives. Here's a step-by-step breakdown of what actually happens to your data, from writing to deletion, and what you can recover.
What You'll Need
- An SSD (internal or external) — the steps apply to SATA, NVMe, and M.2 drives.
- For recovery attempts: a computer with a free USB port or an available drive bay, and recovery software (like Recuva, TestDisk, or the SSD manufacturer's own tool).
- For secure erasure: the SSD's proprietary software (e.g., Samsung Magician, Crucial Storage Executive) or a tool like Parted Magic (paid) or the built-in
secure erasecommand in Linux. - Optional: a second storage drive to back up important files before any secure erase.
Step-by-Step
1. Writing Data to the SSD
- When you save a file, the operating system sends the data to the SSD's controller.
- The controller writes the data into NAND flash cells, typically in pages (4KB–16KB) and blocks (multiple pages).
- The drive's firmware maps logical addresses (what the OS sees) to physical locations using a translation layer (FTL). This mapping is stored in the drive's memory and updated continuously.
2. Deleting a File (Normal Delete)
- When you delete a file (to Recycle Bin or Shift+Delete), the OS simply marks the file's logical blocks as free in the file system (e.g., NTFS, APFS, ext4).
- The actual data remains in the NAND cells — it is not overwritten or erased at this point.
- The SSD's controller may or may not know about the deletion, depending on whether TRIM is enabled.
3. TRIM Command (The Key Difference vs. HDD)
- If TRIM is enabled (default on modern Windows, macOS, and Linux), the OS sends a TRIM command to the SSD, telling it which logical blocks are now unused.
- The SSD's controller then marks those physical NAND pages as invalid and adds them to a “free” pool for future writes.
- This does not immediately erase the data; it simply makes the cells available for overwriting. The old data remains until the drive writes new data to those same cells.
- If TRIM is disabled (e.g., on older systems or external drives via USB), the SSD doesn't know which blocks are free, so it may keep the data longer, but performance degrades over time.
4. Garbage Collection (Background Cleanup)
- Even without TRIM, the SSD's controller runs garbage collection in the background.
- It identifies blocks that contain invalid (deleted) pages and, if needed, copies any still-valid pages from those blocks to new locations, then erases the entire block.
- This erases the actual data bits, making the cells ready for rewriting. This process happens automatically, often when the drive is idle.
- Garbage collection is why data on an SSD may become unrecoverable faster than on an HDD, even without TRIM.
5. Overwriting (The Real Erasure)
- When you write new data to the SSD, the controller writes to cells that are marked as free (either from TRIM or garbage collection).
- If the cells still contain old data, the controller may need to erase the entire block first (since NAND can only write to erased cells). This erase operation physically destroys the old data.
- Once overwritten, the old data is gone — it cannot be recovered by any software.
6. Secure Erase (If You Want to Wipe the Drive)
- To ensure all data is permanently gone, use the SSD's built-in secure erase feature (via the manufacturer's tool or a utility like
hdparmon Linux). - Back up any data you need, because secure erase permanently destroys everything on the drive.
- Run the secure erase — this command forces the controller to erase all NAND blocks, resetting the drive to factory state.
- After secure erase, the drive performs at full speed again, and all data is unrecoverable.
Common Mistakes
- Assuming deleted files are gone forever: They aren't — until overwritten or garbage-collected, they can be recovered with software.
- Using “quick format” for secure deletion: A quick format only removes the file system index; the data remains. For a full wipe, use secure erase or a full format (which still may not erase all cells).
- Disabling TRIM to “protect” data: This actually slows the drive and doesn't protect data — it only delays erasure, not prevents it.
- Attempting to recover data after a secure erase: Once secure erase is done, there is no recovery. Don't waste time or money.
- Ignoring wear leveling: The SSD's controller spreads writes across all cells to prevent premature wear. This means deleted data may be scattered across the drive, making recovery harder.
Tips
- If you need to recover deleted files, stop using the SSD immediately — any new write can overwrite the deleted data. Mount it as read-only or remove it.
- For sensitive data, use full-disk encryption (like BitLocker, FileVault, or LUKS) from the start. Then even if data is recovered, it's unreadable.
- Enable TRIM if it's not already (check with
fsutil behavior query DisableDeleteNotifyon Windows, ortrimforce enableon macOS). This keeps the SSD fast and ensures deleted data is marked for erasure. - Use the SSD manufacturer's secure erase tool for a reliable wipe — third-party tools may not support all controllers.
- If you're selling or disposing of an SSD, always perform a secure erase, not just a format.
Troubleshooting
If data recovery fails:
- Try a different recovery tool — some handle SSDs better than others (e.g., R-Studio, EaseUS Data Recovery Wizard).
- If the drive is detected but recovery is slow, it may be due to garbage collection — stop and try again after making a disk image (using a tool like ddrescue) to avoid further changes.
- If the SSD is not detected at all, check connections (SATA cable, M.2 seating) and ensure the drive is powered. Try a different port or computer.
- If TRIM has already run, the data may be unrecoverable — accept that and consider professional recovery services only if the data is extremely valuable (note: success is low for SSDs).
If secure erase fails:
- Ensure the drive is not in use (unmount it, close all programs).
- Some tools require the drive to be in a specific state (e.g., not frozen). Use the manufacturer's tool; if it says “frozen,” try a different SATA port or use a hot-plug method (if supported).
- On Linux, you can use
hdparm --user-master u --security-set-pass p /dev/sdXthenhdparm --user-master u --security-erase p /dev/sdX. - If all fails, check the manufacturer's support page for model-specific instructions.
Frequently Asked Questions
Can I recover deleted files from an SSD?
Yes, but only if the data hasn't been overwritten or garbage-collected. The sooner you stop using the drive, the better. Recovery software may work if TRIM hasn't been issued or if the drive is old and lacks TRIM.
Does TRIM permanently delete data?
TRIM marks blocks as invalid for the controller, but it doesn't instantly erase them. The actual erasure happens later during garbage collection or when the block is overwritten. So data may remain physically for a while, but the OS considers it gone.
Why is data recovery from an SSD harder than from a hard drive?
SSDs use wear leveling and garbage collection, which actively move and erase data even when idle. Hard drives don't do this, so deleted files remain in place until overwritten.
Does a full format erase SSD data?
A full format (not quick) writes zeros to all sectors, which will overwrite most data, but some cells may be skipped due to over-provisioning or bad blocks. For complete erasure, use secure erase.
What is the difference between secure erase and a format?
Secure erase is a low-level command that tells the SSD controller to erase all NAND blocks, including over-provisioned areas, resetting the drive to factory state. A format only writes to the logical blocks visible to the OS, leaving some physical areas untouched.
Can I recover data after a secure erase?
No. Secure erase physically erases all NAND cells, making data unrecoverable by any means, including professional recovery.