rasz_pl wrote on 2026-07-31, 12:45:
Trim should take split second when you are using sane file system. It sends the list of unallocated sectors to the drive and thats it, done. After that Drive is free to internally reallocate space however it pleases and take as much time as it wants.
Just wanted to restate things for my own edification here-- Let me know if I missed or misstated anything important.
Deleting a file before Trim:
- Operating system updates the directory structure and the allocation table saying the file is gone.
- SSD preserves data on the sectors used by old file until a new file overwrites the sectors because nothing was done with these sectors
- Deleted files can be "undeleted" via old school 1980's methods.
Deleting a file with Trim:
- Operating system updates the directory structure and the allocation table saying the file is gone.
- Operating system send a list of sectors used by the deleted file to get "trimmed" (like a hedge in the spring). This is not a lot of overhead.
- SSD tags the sectors from the TRIM list as stale
And then there is the async garbage collection phase that occurs later on the SSD as time allows:
- blocks that recently became unused (only contain stale sectors) are erased and returned to the wear leveling pool.
- used sectors on partially allocated blocks are condensed to create additional unused blocks
- old files that have not been updated in a long time stored on blocks with a low usage count may get moved to blocks that have a high write count, freeing up blocks with a low write count for the buffer pool
So you can sort of see how good garbage collection can keep an SSD working for a long even without trim. Even if the SSD thinks that the drive is 99% full because the deletes were not trimmed, the garbage collection will eventually swap the data on those "cold" blocks to the hot blocks to keep things from dying. But this causes "write amplification", where more writes than necessary occur on the drive, because unwanted data from deleted files is getting shuffled around when it doesn't need to be. That theoretically reduces performance and shortens the life of device, however any SSD made in the recent past , even if operating at max write amplification, is still going to have much better performance and a much longer life expectancy than any 15 year old worn out spinny disk machine you might find in the back of your cupboard.