Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

TRIM on SSDs External and Internal

With the blending of the TB3 and USB in the new USB4/TB4 standard as well as the advent of USB 3.2 Gen 2 and Gen 2x2 I am wondering about the status of TRIM for SSDs. Once USB became fast enough to realize an advantage to using SSDs rather than HDDs it would seem logical for USB to start supporting TRIM. I do realize many SSDs have garbage collection. I am just wondering if TRIM works in the newer faster versions of the changing USB standards. OR is everything left up to the SSD internal garbage collection. Ideally some authorities on macOS and major SATA SSD vendors would reply to this like (Crucial, Samsung, WD, Seagate). I am aware fo the TRIMFORCE command and some of the history, but this question is directed at the current status of TRIM for external SSDs and most particularly the 5Gbps, 10Gbps, 20Gbps iterations. Let's postulate macOS 11.6 or higher and an iMac with USB and TB3 attached external 2.5" SATA SSDs. Comments about Raid arrays of USB devices apply.


Thank you all in advance for your thoughts and input. Please include references/links to resources.

Posted on Nov 22, 2021 10:46 PM

Reply
Question marked as Best reply

Posted on Nov 26, 2021 11:23 AM

Really not seeing as much need for OS provided TRIM that once was a major problem in the early days of solid state disks. I've not experienced any problems with SSD external storage and a lack of TRIM support. Most all SSD manufacturers are providing vastly improved garbage collection built-in to their firmware and the functions are far more sophisticated than when SSD technology was new. Not to mention over-provisioning, although enterprise class SSDs have much more over-provisioning because they will be worked hard over a longer period of time and likely placed into RAID systems. Regular retail SSDs are now providing far more over-provisioning than in the past. Then you have encryption turned on by default in Apple T2 equipped or Apple Silicon Macs.


The way SSD flash memory works is you cannot just overwrite sectors with new data. You need to erase the sector first then write to it and that is a slow process. OS level TRIM was added to operating systems to overcome this problem. TRIM will erase sectors marked for deletion when the computer is at idle. Over time the SSD manufacturers improved their firmware garbage collection.


Forensic workers found out the hard way about firmware garbage collection. They removed a modern SSD and added a write-block physical adapter then applied power to the drive like they always did with HDDs and it would start scrubbing sectors marked for deletion with no assistance from an OS providing TRIM support. To preserve forensic data they need to desolder the flash chips from the SSD and mount them in a custom rig with their own custom firmware to avoid this problem. Hardware level encryption further complicates forensics. Apple Intel Macs with T2 chips or Apple Silicon Macs are factory encrypted using the Secure Enclave even before you turn on FileVault2. Enabling FileVault2 merely generates the recovery key and stuffs a new private key into the Secure Enclave chip which acts as a black box. It no longer needs to begin encrypting every sector as they are already encrypted at the factory. The Secure Enclave can be written to but not read from and it holds all the secrets. The operating system merely passes a public key to the Secure Enclave which answers YEA / NAY for a matching private key. The private key is never read. You can only write to the Secure Enclave or reset/erase it to start over.


The holy grail would be a new type of non-volatile RAM that retains its memory when power is removed but is just as fast if not faster than existing RAM. When that happens, it will change everything. You won't have internal storage anymore you will have unified non-volatile RAM. Operating systems will change to handle it. There will be no more sleep nor hibernation you will just switch off and when you switch on pickup where you left off. There will be no more shuffling of data from storage to RAM and back again. The memory will be just altered in place as needed on the fly. We already see the benefits of unified RAM when having an integrated GPU instead of a discrete GPU with it's own high speed RAM and the need to shuffle from storage to CPU to RAM to GPU to the GPU RAM and round trip back again. This is many orders of magnitude more efficient with Apple Silicon. Having high speed nonvolatile RAM would change everything. IBM / Intel and others are working on new materials and striving to invent nonvolatile RAM. One day they may achieve it. Perhaps with quantum computing in the coming decades.


Ultimately, you really do not need to concern yourself with an external SSD having issues due to a lack of TRIM support. Unless you are using something that is 10 years old, etc. SSD's are provisioned to likely outlast most computers normal lifespans. Internal storage is where TRIM support matters most as the data is being accessed far more often. Yes, having TRIM support is best but if you do not have it, the drives firmware will take care of it to the point where you are not really going to see massive performance degradation. If you are concerned, you can backup to another extra drive and reformat the SSD and copy the data back. But it would only be necessary after several years of heavy usage. Even then, newer drives would not only be cheaper but faster with greater capacity.

7 replies
Question marked as Best reply

Nov 26, 2021 11:23 AM in response to rrnowell

Really not seeing as much need for OS provided TRIM that once was a major problem in the early days of solid state disks. I've not experienced any problems with SSD external storage and a lack of TRIM support. Most all SSD manufacturers are providing vastly improved garbage collection built-in to their firmware and the functions are far more sophisticated than when SSD technology was new. Not to mention over-provisioning, although enterprise class SSDs have much more over-provisioning because they will be worked hard over a longer period of time and likely placed into RAID systems. Regular retail SSDs are now providing far more over-provisioning than in the past. Then you have encryption turned on by default in Apple T2 equipped or Apple Silicon Macs.


The way SSD flash memory works is you cannot just overwrite sectors with new data. You need to erase the sector first then write to it and that is a slow process. OS level TRIM was added to operating systems to overcome this problem. TRIM will erase sectors marked for deletion when the computer is at idle. Over time the SSD manufacturers improved their firmware garbage collection.


Forensic workers found out the hard way about firmware garbage collection. They removed a modern SSD and added a write-block physical adapter then applied power to the drive like they always did with HDDs and it would start scrubbing sectors marked for deletion with no assistance from an OS providing TRIM support. To preserve forensic data they need to desolder the flash chips from the SSD and mount them in a custom rig with their own custom firmware to avoid this problem. Hardware level encryption further complicates forensics. Apple Intel Macs with T2 chips or Apple Silicon Macs are factory encrypted using the Secure Enclave even before you turn on FileVault2. Enabling FileVault2 merely generates the recovery key and stuffs a new private key into the Secure Enclave chip which acts as a black box. It no longer needs to begin encrypting every sector as they are already encrypted at the factory. The Secure Enclave can be written to but not read from and it holds all the secrets. The operating system merely passes a public key to the Secure Enclave which answers YEA / NAY for a matching private key. The private key is never read. You can only write to the Secure Enclave or reset/erase it to start over.


The holy grail would be a new type of non-volatile RAM that retains its memory when power is removed but is just as fast if not faster than existing RAM. When that happens, it will change everything. You won't have internal storage anymore you will have unified non-volatile RAM. Operating systems will change to handle it. There will be no more sleep nor hibernation you will just switch off and when you switch on pickup where you left off. There will be no more shuffling of data from storage to RAM and back again. The memory will be just altered in place as needed on the fly. We already see the benefits of unified RAM when having an integrated GPU instead of a discrete GPU with it's own high speed RAM and the need to shuffle from storage to CPU to RAM to GPU to the GPU RAM and round trip back again. This is many orders of magnitude more efficient with Apple Silicon. Having high speed nonvolatile RAM would change everything. IBM / Intel and others are working on new materials and striving to invent nonvolatile RAM. One day they may achieve it. Perhaps with quantum computing in the coming decades.


Ultimately, you really do not need to concern yourself with an external SSD having issues due to a lack of TRIM support. Unless you are using something that is 10 years old, etc. SSD's are provisioned to likely outlast most computers normal lifespans. Internal storage is where TRIM support matters most as the data is being accessed far more often. Yes, having TRIM support is best but if you do not have it, the drives firmware will take care of it to the point where you are not really going to see massive performance degradation. If you are concerned, you can backup to another extra drive and reformat the SSD and copy the data back. But it would only be necessary after several years of heavy usage. Even then, newer drives would not only be cheaper but faster with greater capacity.

Nov 26, 2021 1:00 PM in response to James Brickley

Thank you James for your reply and time! I appreciate it. As I understand it the Garbage Cleaning takes place at a different level than the TRIM command. The TRIM command forces the OS to tell the SSD that files marked "deleted" should be truly deleted/erased. As i understand it, TRIM informs the SSD controller so it can erase that space. As I understood it, the TRIM command did not work on USB attached ssds. I am using a SoftRAID and it marks ssds attached via USB as having TRIM enabled at times. I have also done some testing of the write speeds and seen a marked difference in write speeds when I executed the TRIMFORCE enable command. I don't claim to know what is going on, but the performance difference is there. I am trying to understand. IF the TRIM command does improve write speeds even if it is only with legacy SATA speed limited ssds it seems it would be good for users to support it at least at the higher bandwidth/speed USB specs. If USB4 and TB3/TB4 are the same, then does USB4 support TRIM like TB3/4 does? Or maybe TB3/TB4 doesn't support TRIM? The only thing I am certain of is seeing a performance difference on write when I execute the TRIMFORCE enable command. My best understanding is that this helps the SSD garbage collection find more space it can erase leaving more space to be immediately written to.


Again, thank you for your post. Please share more if you will.

Nov 26, 2021 1:48 PM in response to rrnowell

My point was that TRIM is not as necessary as it once was as modern firmware garbage collection typically is enough for say a single SSD external drive that isn't being heavily used. You didn't mention SoftRAID. To me, sounds like you need to up your storage game to the next level.


I would just obtain a NAS box and move all the data there and be done with it. Far more expandable and reliable. Something like a Synology or TrueNAS you build yourself or buy an appliance. Either solution would involve multiple HDD's and a couple of SSD cache drives. At that point the bottleneck would be your network. If you choose NAS appliances that have dual 1GB or even better 10GbE and a managed network switch you can bind the two 10GbE ports together. If you really need the performance of an all SSD NAS it won't be inexpensive and you should definitely use enterprise class SSD drives as you'll wear out retail SSDs very quickly.




Nov 27, 2021 6:05 PM in response to rrnowell

There are actually two types of TRIM, continuous and periodic. Continuous TRIM is what most people think of when discussing TRIM support as it is associated with the file system reporting to the SSD which blocks are to be TRIMmed and can lead to data corruption if the file system and SSD do not implement TRIM support properly. Many SSDs do not enable TRIM properly.


From my understanding, Periodic TRIM tells the SSD to clean up the NAND blocks right now instead of waiting for the Garbage Collection routines since the Garbage Collection routines usually wait until the SSD is idle. Operating Systems typically send a TRIM request to an SSD every X hours/days/week (hence periodic). AFAIK, from some of the more knowledgeable contributors on these forums macOS uses a periodic TRIM.


TRIM support for external drives is problematic as the drive requires a USB controller chip which supports TRIM. Drive manufacturers are cheap & sleazy and often overlook providing appropriate access to the full capabilities of drives. It is hard to say whether an external SSD will be able to use TRIM. It doesn't help that Apple is less than forthcoming about this information as well.


Nov 27, 2021 6:11 PM in response to HWTech

I had no knowledge of the two types of TRIM or what type Apple uses. Thank you. Do you happen to know where the TRIMFORCE command plays into all of this? Does Apple automatically assert TRIM for external drives ssds or is TRIMFORCE required. Does the TRIMFORCE enabled TRIM stay on with Sleep? with a Restart? with a Shutdown? I wish Apple's tech people would weigh in on these from time to time. Thank you again! Have a Happy Thanksgiving weekend!

TRIM on SSDs External and Internal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.