moritzhberg wrote:
I really don't want to sound thick or anything, but are TRIM and Garbage collection the same thing?
"Most new SSDs come with garbarge collection which negates having TRIM enabled in the OS", from this, I would derive that I don't need to enable TRIM, as garbage collection will take care of it, right?
Sorry for being so complicated...
That's hardly being thick - it's a complicated question and I don't think there's a definite answer because controller and firmware variations of the SSD combined with the platform all this is going on in can change the answer.
As I understand it, garbage collection deals with the fact that unlike a HD, the pages on an SSD can't be written to until they're first actively erased, and, again unlike HD's, much larger blocks, containing many pages, are the smallest units that can be erased even though individual pages on them can be written to. When pages need to be overwritten, this process becomes necessary. Since in those blocks are pages of valid data which are not due for erasure, they have to be moved before any erasing can take place. The accumulation of valid data being written into fresh or newly erased blocks and the erasing of the now cleared blocks is the garbage collection process, and some controllers may do that garbage collection when space is needed, while others anticipate the need and operate when there's free time, and still others do both. In either case, the OS telling the SSD to overwrite files at LBA's (logical block addresses) gets the ball rolling. That doesn't apply to files on pages the OS simply declares no longer valid. As such, when a block has to be relocated prior to erasure, the no longer valid files get moved along with the valid data because the SSD's don't know that the files, not having been explicitly overwritten, are no longer valid.
TRIM is a communication between the OS and the SSD controller that newly invalid but not overwritten files should be erased too. As such, it's an adjunct to regular garbage collection but there is some overlap and a difference in timing. So while garbage collection will get the job done, it will be moving and writing pages which don't have to be, and since the number of writes to any page is limited, more writes than necessary are to be avoided when possible. This extra writing is known as write amplification. To quote Wikepedia, "Write amplification (WA) is an undesirable phenomenon associated with flash memory and solid-state drives (SSDs) where the actual amount of physical information written is a multiple of the logical amount intended to be written. Because flash memory must be erased before it can be rewritten, the process to perform these operations results in moving (or rewriting) user data and metadata more than once. This multiplying effect increases the number of writes required over the life of the SSD which shortens the time it can reliably operate." TRIM helps to reduce write amplification. Put another way, you can get there from here without TRIM, just not as well.
And to quote you, "sorry to be so complicated." There are times when I miss hard disks.😉