SSDs use NAND flash memory for data storage. Each cell can hold from one to four bits of data. The form of data inside the NAND flash is binary, which means just 0s and 1s. On the very basic level, it is just high and low levels of electric charge inside the cells. As the number of cells increases, the number of levels of charge will be more but the storage capacity will increase.
When we write the data, the memory cells are programmed at different charge levels. The place where the charge is actually stored is mainly charge-trap flash transistors. Earlier, they were floating gate transistors. You can know the difference here.
Due to their inherited physical properties, these transistors have a limited number of read/write cycles. So, SSD manufacturers equip their controllers with different algorithms to reduce or spread this wear. Writing is more destructive for the NAND flash than reading.

The process of deleting the data in SSDs
The data is stored in the form of bits inside the NAND flash. When we delete the data, these bits are deleted. But, in SSDs, the process is a little complex as the individual memory cells aren’t read or written directly. The smallest readable and writeable unit in SSDs is a page, typically consisting of 4 KB to 16 KB. The smallest erasable unit is a block, which is generally bigger, with a size ranging from 512 KB to 4 MB. These abstractions are to enhance the read/write speed, reduce overhead/errors.





However, when we talk specifically about the writing process, there is a catch to it. Data can be written to a page, but only if the page is completely empty. This is because the cell must be activated with the control line in order to write or read the data from and to the bit line. You can learn more about the control line and bit line here. Having a clean page makes the writing process faster and less prone to errors. If the controller has to first erase the memory cell and then write the data, it will take a lot longer than writing on an empty page.
What is the role of TRIM?
TRIM is the process being run by the operating system. Most modern operating systems, like Windows 7 and later, macOS, and many Linux distros support TRIM. With the help of TRIM, an operating system informs the SSD which blocks of data are no longer in use and can be cleared internally. The TRIM command proactively clears these unused blocks to the SSDs so that they don’t have to erase them during a future write operation.
TRIM has major benefits in performance, longevity, and garbage collection. But when TRIM is enabled, data recovery (if required) is generally impossible. Without TRIM, this deleted data can be recovered if we want because the pages or blocks are marked as available, but the data is still there. But with TRIM enabled, the OS will clear out those locations when the system is idle. In this case, once TRIM has cleared those data blocks, the data can’t be recovered.
Why is TRIM important?
TRIM is most helpful in increasing the data write speed because the NAND flash has inherently slower write speed than the read speed due to the programming steps involved. Having to erase the memory cells before writing the data makes the writing process much complex and time-consuming. TRIM helps in enhancing the data write speed by clearing out the unused data blocks and pages.
If TRIM isn’t working, the write amplification increases. Write Amplification is a phenomenon in SSDs where the actual amount of data written on the NAND flash becomes greater than the total data that we intended to write. This happens due to the additional steps of block erasure and data movement. TRIM reduces the Write Amplification by informing the SSDs of unused data and improving garbage collection.
Without TRIM, the SSDs can easily move stale data from here to there while organizing the blocks or while preparing them for the incoming data. This increases unnecessary data. But with TRIM, this stale data is deleted.
Working of TRIM
There are several steps in which the TRIM command works in any SSD. They can vary, but the basic idea is as follows.

1. File Is Deleted (or Modified) in OS
The user or a system process deletes a file. The file system (e.g., NTFS, ext4, APFS) marks the space as free in its structure, and the operating system knows that. Normally, the physical data still exists on the SSD.
2. OS Issues a TRIM Command
The operating system sends a TRIM command to the SSD, specifying the Logical Block Addresses (LBAs) that are no longer in use. These LBAs map to NAND flash memory pages, and the OS is mainly responsible for choosing the right blocks.
3. SSD Marks Pages as Invalid
The SSD flags the specified pages in its internal Flash Translation Layer (FTL) as “invalid” or “available”. These invalid pages are now eligible for erasure during future garbage collection.
4. Garbage Collection (Later)
When the SSD needs free space, it performs garbage collection. In this process, it collects valid pages from a block. It skips the TRIMed or invalid pages and rewrites valid data to a new block. Then erases the entire old block, which now contains only invalid pages. This clears the TRIMed data, physically erasing it.
The length of the TRIM command varies in format and length. In SATA SSDs using the ATA protocol, the command name is DATA SET MANAGEMENT, and the command code is 0x06. This command can specify 8 or 256 Logical Block Addresses per command, but can vary based on the ATA version. In NVMe SSDs, thousands of LBA’s can be specified in a single TRIM command.
When Is the Data Actually Cleared?
TRIM does not clear out the data immediately, but it just marks the data that is no longer needed. The erasure actually happens during the garbage collection, which is done by the SSD’s controller. The erasure will happen generally when the SSD runs out of free blocks or when the system is idle. In simple words, the erasure is asynchronous and non-deterministic. It can be done immediately or sometimes hours or days later. However, the marking is done almost instantly by the operating system and the command is sent directly to the SSD.
SSDs with TRIM and without TRIM
Operation | With TRIM | Without TRIM |
---|---|---|
File Deletion | OS notifies SSD via TRIM which pages are no longer needed | OS marks file as deleted, but SSD doesn’t know the data is invalid |
SSD Awareness | OS marks the file as deleted, but SSD doesn’t know the data is invalid | SSD treats all pages as potentially valid |
Write Operation | SSD can use pre-erased blocks more efficiently | SSD may need to move and rewrite data, increasing write load |
Garbage Collection | Skips TRIM-marked pages (deleted data) — less data moved | Copies both valid and invalid (deleted) data — more internal write activity |
Write Amplification | Lower — fewer internal writes needed | Higher — more internal writes due to unnecessary copying |
Performance Over Time | Maintains high performance as SSD stays cleaner | Gradually degrades due to increasing write amplification |
SSD Lifespan | Extended — fewer program/erase cycles required | Shortened — more wear from redundant data movement |
Efficiency | High — less overhead, better garbage collection | Low — inefficient block management |
Example Scenario | Delete a 1 GB file → SSD erases marked pages directly | Delete a 1 GB file → SSD may keep moving those pages until overwritten |
How to enable or disable TRIM?
Enabling trim in Windows
- Open Command Prompt as an administrator.

- Type fsutil behavior query DisableDeleteNotify and press Enter.

- If the result is DisableDeleteNotify = 0, TRIM is enabled. If it is 1, TRIM is disabled.
Enable TRIM:
- If TRIM is disabled, you can enable it by typing fsutil behavior set DisableDeleteNotify 0 in the Command Prompt and pressing Enter.

Enabling TRIM in macOS
- Check if TRIM is enabled:
- macOS usually enables TRIM for Apple SSDs by default. For third-party SSDs, you may need to enable it manually.
- Enable TRIM:
- Open Terminal.
- Type sudo trimforce enable and press Enter.
- Follow the on-screen prompts and restart your Mac.
Enabling TRIM in Linux
- Check if TRIM is supported:
- Open Terminal.
- Type sudo hdparm -I /dev/sdX | grep TRIM (replace /dev/sdX with your SSD device) and press Enter.
- If you see
Data Set Management TRIM supported
, TRIM is supported.
- Enable TRIM:
- For ext4 filesystems, you can enable periodic TRIM by editing
/etc/fstab
. Adddiscard
to the mount options for your SSD partition, like so:makefileCopy codeUUID=xxxx-xxxx / ext4 discard,errors=remount-ro 0 1
- Alternatively, use fstrim to manually trigger TRIM:Copy code
sudo fstrim -v /
- For ext4 filesystems, you can enable periodic TRIM by editing
In most modern systems and configurations, you will find trim already enabled, and most SSDs have the TRIM feature. But it’s good to verify. After enabling, you can give your system a reboot and some time to work. You will surely see some performance boost over time.
Conclusion
TRIM is a critical SSD command that helps maintain performance, increase lifespan, and reduce write amplification. It prevents the SSDs from wasting resources and time copying and rewriting stale data during the internal processes like garbage collection. TRIM minimizes unnecessary write operations and controls the already limited program/erase cycles of the flash memory. However, data recovery is generally impossible when TRIM is enabled. But, this is the only drawback that you get with TRIM. Everything else is just benefits.