Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mike Boreham

macrumors 68040
Aug 10, 2006
3,914
1,897
UK
For example when you fill your SSD up with lat summer's holiday videos and photos, then delete them all because you want to use the drive for something else. From a filesystem point of view the SSD is empty, but without TRIM it is still full for the drive controller. When you start filling the drive again then the data in the blocks that are written again is known to be garbage, but all the other data blocks that have only been deleted at the filesystem level will won't and will be saved and copied around during wear levelling even though they are garbage.
Surely Garbage Collection will (maybe more slowly) deal with last summer's deleted photos even without TRIM. Deliberately deleted files make up the vast majority of my data churn. If GC does not handle these I am surprised by the manufacturers statements I quoted in post#9.
 

Basic75

macrumors 68020
May 17, 2011
2,101
2,448
Europe
Surely Garbage Collection will (maybe more slowly) deal with last summer's deleted photos even without TRIM.
No, because the garbage collection does not know these files were deleted. That's the whole point. Like all drives, an SSD is divided into numbered blocks or sectors. When a sector is written then the SSD controller considers it filled with user data. Only when the OS "trims" the sector when the corresponding file is deleted is the controller informed that the sectors are now garbage. Or when the sector is overwritten with new data then the the old version of the data is known to be garbage (due to wear levelling the old and new version of the same logical sector number will usually end up in different parts of the flash cells). So in this case the old version is garbage, but the new version takes its place as occupied and the number of occupied sectors never changes.
 
  • Like
Reactions: Mike Boreham

Basic75

macrumors 68020
May 17, 2011
2,101
2,448
Europe
If GC does not handle these I am surprised by the manufacturers statements I quoted in post#9.
Everything will work, the GC/wear levelling just has to "work harder". If you fill the whole SSD, then delete everything, then create a large file and keep overwriting the data in it then the wear levelling can not just use the space from the deleted files, it will always copy their content to less worn flash cells because in the absence of TRIM it can't treat it as garbage.
 
  • Like
Reactions: Mike Boreham

Mike Boreham

macrumors 68040
Aug 10, 2006
3,914
1,897
UK
No, because the garbage collection does not know these files were deleted. That's the whole point. Like all drives, an SSD is divided into numbered blocks or sectors. When a sector is written then the SSD controller considers it filled with user data. Only when the OS "trims" the sector when the corresponding file is deleted is the controller informed that the sectors are now garbage. Or when the sector is overwritten with new data then the the old version of the data is known to be garbage (due to wear levelling the old and new version of the same logical sector number will usually end up in different parts of the flash cells). So in this case the old version is garbage, but the new version takes its place as occupied and the number of occupied sectors never changes.
Everything will work, the GC/wear levelling just has to "work harder". If you fill the whole SSD, then delete everything, then create a large file and keep overwriting the data in it then the wear levelling can not just use the space from the deleted files, it will always copy their content to less worn flash cells because in the absence of TRIM it can't treat it as garbage.

Thanks for the detail. So the Executive Summary is that GC (without TRIM) gets the job in the end.
 

Basic75

macrumors 68020
May 17, 2011
2,101
2,448
Europe
Thanks for the detail. So the Executive Summary is that GC (without TRIM) gets the job in the end.
The executive summary is that an SSD without TRIM will work just fine, but it will waste some amount of time, energy, performance and write cycles on moving around some garbage.
 
  • Like
Reactions: Mike Boreham

jdb8167

macrumors 601
Nov 17, 2008
4,859
4,599
Everything will work, the GC/wear levelling just has to "work harder". If you fill the whole SSD, then delete everything, then create a large file and keep overwriting the data in it then the wear levelling can not just use the space from the deleted files, it will always copy their content to less worn flash cells because in the absence of TRIM it can't treat it as garbage.
One thing to keep in mind is that Apple has designed the SSD controller and the OS simultaneously. It is entirely possible that Apple does the equivalent of TRIM in the OS along with normal APFS maintenance. They aren't using an off the shelf SSD controller that has to be separate from the OS functionality. Apple's garbage collection could be significantly more efficient than the standard controller's.

I wonder if the Asahi developers have to do anything with the SSD controller or if that is something already handled by the firmware blobs.
 

Mike Boreham

macrumors 68040
Aug 10, 2006
3,914
1,897
UK
One thing to keep in mind is that Apple has designed the SSD controller and the OS simultaneously. It is entirely possible that Apple does the equivalent of TRIM in the OS along with normal APFS maintenance. They aren't using an off the shelf SSD controller that has to be separate from the OS functionality. Apple's garbage collection could be significantly more efficient than the standard controller's.
@jdb8167
Thanks. I assume the above might only be the case for the Apple internal SSD, so no help to external USB SSDs, or are you suggesting it might be part of normal APFS maintenance, so would help them?

If they are doing anything different they still call it TRIM in System Report.
 
  • Like
Reactions: Basic75

jdb8167

macrumors 601
Nov 17, 2008
4,859
4,599
@jdb8167
Thanks. I assume the above might only be the case for the Apple internal SSD, so no help to external USB SSDs, or are you suggesting it might be part of normal APFS maintenance, so would help them?

If they are doing anything different they still call it TRIM in System Report.
I was talking about the internal SSD controller. Sorry, I guess I'm off topic.
 

AAPLGeek

macrumors 6502a
Nov 12, 2009
731
2,271
Thanks for the detail. So the Executive Summary is that GC (without TRIM) gets the job in the end.

One thing to keep in mind is that Apple has designed the SSD controller and the OS simultaneously. It is entirely possible that Apple does the equivalent of TRIM in the OS along with normal APFS maintenance. They aren't using an off the shelf SSD controller that has to be separate from the OS functionality. Apple's garbage collection could be significantly more efficient than the standard controller's.

I wonder if the Asahi developers have to do anything with the SSD controller or if that is something already handled by the firmware blobs.


TRIM actually works beautifully on APFS formatted external SSDs. You can use this command in terminal to verify:

Code:
log show --predicate "processID == 0" \           
  --start $(date "+%Y-%m-01") | grep spaceman

My Samsung T5 is 97% full and still retains its original performance.

T5 10G Intel.jpg


More info in this thread:

 

Mike Boreham

macrumors 68040
Aug 10, 2006
3,914
1,897
UK
TRIM actually works beautifully on APFS formatted external SSDs. You can use this command in terminal to verify:

My Samsung T5 is 97% full and still retains its original performance.

More info in this thread:


I took part in that thread and it seemed rather inconclusive to me.

Not convinced that your T5 being 97% full and retaining original performance proves that TRIM is active as GC would do that.

PS just to clarify, Apple does support TRIM on external SSDs connected by Thunderbolt.
 
Last edited:
  • Like
Reactions: doboy
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.