is my understanding of TRIM and GC right ?

maicod

Junior Member
Sep 21, 2014
1
0
0
I recently purchased my first SSD (128GB Sandisk Ultra Plus) and I'm trying to understand what happens during TRIM and GarbageCollection. I setup an explanation text for myself and I like to ask if everything is correct in it ?

here's my text:

my assumptions of SSD operation in my own words:
--------------------------------------------------

1) TRIM is there to prevent more Garbage Collection work by conveying to the SSD the filesystems knowlegde of which sectors ('under the hood' they are using flash cell blocks) are belonging to a deleted file so some of these flash blocks are now completely holding invalid data and can be skipped by GC.

2) Garbage Collection is there to move valid data out of flashmemory Blocks that also hold invalid data, to a new flash block. The old block isnt erased with zeros but fully free of valid data. Then if this old block is needed to save new data to it can be cleared with a full block erase command and be written to.

If there would have been no garbage collection on an SSD then there could be the situation that the drive still has free space but that all this space resides in flash blocks that also hold valid data. This would mean that during a data write operation it would first need to read the valid data and store it in its RAM cache, then erase the whole block and then write the mix of the old and new data to that flash block and that takes more time and so makes write operations slower.

-----

Did I make any errors in the above ? Am I correct that during TRIM and GC no flash blocks are actually written to with zeros ? I think that would wear-out the flash cells unnecessarily.
 

BrightCandle

Diamond Member
Mar 15, 2007
4,762
0
76
1) No not really, trim is there to tell the SSD that a block is now invalid. It gives the SSD earlier notice that the block is empty. Without trim the first moment the SSD would know the block was clear was when the OS overwrote the block. Trim is a hint to the garbage collector, the garbage collector is still doing its thing with that information, it just has it earlier so can avoid poor performance scenarios easier.

2 and 2a - more or less.

Erased flash blocks I believe contain 1's not 0's, but technically they aren't valid once they have been erased until they have been rewritten.