TRIM on Windows: what is gone and what is not

TRIM can erase deleted data on an SSD within minutes - but only when the drive, the bridge, the file system and Windows all support it.

Deleting a file on a hard disk and deleting a file on a solid-state drive are two very different events. On a hard disk the file simply stops being referenced; its bytes sit exactly where they were until something overwrites them. On an SSD the operating system usually goes one step further and tells the drive that those blocks are no longer needed. The storage controller is then free to erase them, and it very often does, within seconds.

That extra step is called TRIM. It is the single biggest reason data recovery works far less often on SSDs than on hard disks, and it is worth understanding before you decide what to do with a drive that just lost data.

The catch is the word “usually”. TRIM only happens when every link in the chain supports it: the drive, the controller or bridge in between, the file system, and the Windows setting. Break any single one of them and the command is never sent, which is why the same SSD can behave completely differently inside a laptop and inside a cheap USB enclosure, and why recovery from a USB stick is a different problem from recovery from an internal drive.

What TRIM actually is#

Flash memory cannot overwrite a block in place. To change anything, the controller has to erase a whole erase block, typically a few megabytes, and then write the new pages into it. Because of that, a drive that keeps deleted data around forever gets slower and slower: every future write has to first copy the surviving pages out of a block that is only partly in use.

TRIM is the fix. It is a command (ATA DATA SET MANAGEMENT on SATA, Dataset Management on NVMe) that says, in effect: “the host no longer needs the data in these logical block addresses.” The drive is then free to unmap them, so the next write can use the block without copying anything and without waiting for an erase later. This is why an SSD that has never been trimmed gradually slows down, and why an operating system that supports TRIM keeps an old SSD fast.

None of that is about security or about saving space. TRIM exists for performance and wear levelling. Losing recovery options is a side effect, an entirely intended one, from the drive's point of view.

When Windows sends it#

Everything in this section assumes three things at once: an NTFS volume, a device that reports itself as TRIM-capable, and the Windows switch left at its default. Given those, TRIM is issued in more situations than most people expect:

  • Deleting a file, including Shift+Delete, and including emptying the Recycle Bin. Anything that ends up as a real delete in the file system sends the file's clusters to the drive as free.
  • Formatting, a quick format of an SSD sends a TRIM for the whole volume, which is why “the format destroyed everything” is so often literally true on flash storage and so rarely true on a hard disk.
  • The weekly optimisation schedule, Windows runs “Optimize Drives” on a schedule (weekly by default) and, on an SSD, that task is a retrim of the free space. A single scheduled run can finish off data that was still lying around.
  • Manually, Optimize-Volume -DriveLetter D -ReTrim in PowerShell forces a retrim immediately.

You can check whether the setting is on with fsutil behavior query DisableDeleteNotify. A result of 0 means TRIM is enabled, which is the default and the right setting for performance. Setting it to 1 disables TRIM, useful only if you deliberately want deleted data to stay put, and a bad idea for the drive's long-term speed. Note that this switch only decides whether Windows is allowed to send the command; it says nothing about whether the hardware underneath understands it.

Newer Windows prints one line per file system, NTFS DisableDeleteNotify = … and ReFS DisableDeleteNotify = …, because the switch is per file system. The classic command without a scope, fsutil behavior set DisableDeleteNotify 1, only changes NTFS; write … NTFS 1 or … ReFS 1 if you want to be explicit. So if you see NTFS disabled and ReFS enabled side by side, that is not a bug: someone turned it off for NTFS only.

When TRIM never reaches the drive#

This is the part most articles skip. The command has to survive a chain, and breaking any link means the data on the drive is never unmapped, which is good news for recovery:

Link in the chainFails when
The driveIt is a spinning hard disk, or a cheap flash controller that does not implement the command at all (common on low-end USB sticks).
The controller or bridgeA USB-SATA or USB-NVMe enclosure, a RAID card, a VHD (VHDX can pass TRIM through, VHD cannot), or a virtual/network disk drops the command. This is the single most common reason TRIM never arrives, and why the same SSD can be recoverable in an enclosure and unrecoverable inside the machine.
The file systemIt is exFAT or FAT32. Windows issues TRIM for NTFS (and ReFS) volumes only. On a USB stick or a camera card, deleting a file normally does not trim anything.
The Windows settingDisableDeleteNotify is set to 1, or the volume is not the kind Windows optimises.
The firmwareRarely, but it is never guaranteed. Even when the command does arrive, a drive is allowed to defer it or ignore it entirely.

Two of those rows matter far more than the rest in practice:

  • Bridges and card readers. Windows asks the device whether it supports TRIM and, if the bridge does not answer, never sends the command. Taking a drive out of a laptop and reading it through a USB enclosure is therefore not only a safety measure, it can also be the difference between zeros and real data.
  • exFAT and FAT32. USB sticks, SD cards and most external drives shipped for use across Windows, macOS and cameras are formatted exFAT or FAT32, and Windows does not trim those file systems. This is the main reason deleted files on a USB stick are so much more often recoverable than deleted files on an internal SSD.

What the drive does with the command#

TRIM is advisory. The drive does not have to act immediately, and different controllers behave differently. In practice you will see one of three outcomes for a trimmed block:

  • Unmapped, then erased on the next garbage collection. The mapping is gone at once and the physical pages are reclaimed during idle time. This is the most common behaviour, and it can happen minutes after the delete.
  • Zeroed on read right away (often called deterministic read zeros after trim). Many consumer drives return zeros for trimmed LBAs immediately, so any later read, including a sector-by-sector image, returns clean zeros.
  • Left alone until the space is needed. Some drives are lazy and the bytes may survive for a while. This is the only case where recovery is still possible, and you cannot tell in advance which drive you have.

The practical consequence is that on an SSD you are working against a clock measured in minutes, and that clock started when you deleted the file, not when you started the recovery tool.

So what actually survives on an SSD?#

Less than on a hard disk, but not nothing. Roughly:

WhatSurvives?
File names, sizes and dates (the NTFS $MFT record)Usually yes. The record lives inside the MFT, which is still in use, so it is never trimmed. That is why a recovery tool can list files that turn out to be completely empty.
The file's contents (the data clusters)Usually no, if TRIM ran. You get zeros, or a block that now belongs to something else.
Files still in the Recycle BinYes, completely, moving a file to the Recycle Bin is a rename, not a delete. Nothing is trimmed until the bin is emptied.
Deleted partitionsOften yes. Windows only trims LBAs that belong to a mounted volume it is deleting from. A partition that is simply not mounted, or whose table entry was lost, is usually not trimmed, so its contents can still be found by scanning.
Data on a FAT32 or exFAT volume (USB sticks, camera cards)Yes, as a rule. Windows does not issue TRIM for those file systems, so deleting a file normally leaves its clusters untouched until they are reused.
Data on an NTFS drive with TRIM disabled, or mounted through a bridge that drops the commandYes. Plenty of USB-SATA and USB-NVMe enclosures never forward TRIM. The same disk can behave very differently inside the machine and in a cheap enclosure.
Anything on a spinning hard diskYes, until overwritten. TRIM on a hard disk does not erase data; the bytes stay where they were.

What to do in the first ten minutes#

  • Power the drive off. Every minute it stays connected gives Windows another chance to run a retrim, and gives the drive more idle time for garbage collection.
  • Do not format, do not run chkdsk, do not “repair” anything on the drive, and do not install recovery software onto it.
  • If you can, connect it to another machine and image it read-only before scanning. An image is a fixed snapshot; the drive is not.
  • Check fsutil behavior query DisableDeleteNotify on the machine that lost the data. If TRIM was off, or the drive was behind a bridge that ignores it, your chances are much better.
  • Scan the image, not the drive, and look at what actually comes back. Names alone mean nothing, the question is whether any sector still has content in it.

What recovery software can and cannot do here#

A recovery tool can rebuild a directory tree, find lost partitions, carve files out of raw sectors and tell you which files still have real content. What it cannot do is un-erase a flash block. Once the controller has erased a block, the electrons that encoded your data are gone, and no software can put them back, the hardware does not keep a copy.

That is why, on an SSD that has been running with TRIM enabled since the deletion, a scan will often show a full list of files with correct names and sizes and return zeros when you open them. That is not a bug in the tool; it is the drive reporting that the blocks are gone. On a hard disk, or on an SSD where TRIM was off or never reached the drive, the same scan returns real content. Our own scanning and preview is built to find that out cheaply: scanning is free and read-only, so you can see whether your data is still there before spending anything.

The short version#

TRIM turns “deleted” into “erased” on flash storage, but only when the whole chain co-operates: a flash drive that understands the command, no bridge in between dropping it, an NTFS volume, and the Windows switch left on. Given all of that, Windows sends it on delete, on format and on a weekly schedule, and you have minutes rather than days.

So do not assume it happened: a USB stick, an SD card, an exFAT volume or the same SSD behind a cheap enclosure may still hold everything. Power the drive off first, image it second, and judge the result by the content of the sectors rather than by the names in the list.

Find out what is still on your drive

Scanning and previewing are free, and nothing is written to the source disk. You will know within minutes whether the files can be recovered.

Download for Windows