"Subject: Third-Party TRIM SSD Support in Mac OS X
I have good news for those people still waiting for support of TRIM command for third-party Solid State Drives (in OS X). Now we have a support!
It was tested with Intel SSD 2nd generation and OCZ Vertex and it is fully working. But for launch to work we need an IOAHCIFamily.kext (Kernel Extension) with Plugin inside called IOAHCIBlockStorage.kext where in the directory you can find a binary with the same name. This can be downloaded now from internet. This kernel extension was taken from Mac OS X 10.6.6 (10J3210) that came with MacBook Pro 2011. (not the std OS X build)
Open it with HEX editor and search for "APPLE SSD". This is verification on "if this Solid State Drive is an Apple or not?" implemented by Apple. Simply change this 9 symbols with first 9 symbols from name of your SSD.
(FYI - per Viktor's later mail (see below), replacing Apple SSD with all Hex zeroes is another/better option)
Install this modified kext with kexthelper (don't forget to rebuild cache with button in kexthelper) and reboot.
This is works on latest Mac OS X 10.6.7 and 10.7 Developer Preview.
I asked about any proof that trim is really working in OS X, not just the OS reporting it as supported. (Many SSDs have GC support in firmware, which has been a plus for OS X users w/o Trim support.)
Here's his reply regarding proof of trim working.
Ok, there are three things:
1) Apple can do it (just show "yes") through detecting media type of Disk in System Profiler (which is more simple) instead of using for this AHCI driver. And another thing - this is all SSDs, just with different names, which all supports unified commands.
2) IOAHCIBlockStorage.kext is not something simple. This driver (Input Output Advanced Host Controller Interface Block Storage) manages all IO for SATA Storage Devices, ie. NCQ, R/W operations, TRIM, etc.. How OS checks that TRIM is supported and works in drive? As you can see in my last message - we tested a group of disks, the ones which support TRIM natively and those which produced early that lacked TRIM support. Those disk that supported it, OS recognized. Those which lacked it OS shows "TRIM Support: No" without exception. To check - IOAHCI after detecting that this is not "rotational" disk (reports no spinning speed), it sends the TRIM commands "BuildATATrimCommand" (found inside IOAHCIBlockStoorage) to the SSD. If SSD executes this, on specific address of clusters after trimming will be zeroes like if we had a secure format with zeroes, then IOAHCI reports that command executed, and SSD supports TRIMming. If the command was ignored and not executed, OS reports that this SSD doesn't support TRIM. This command is not a process which can be monitored by Activity Monitor. It is just a command to SSD's controller which will do this work fully automatically without OS intrusion. This is the algorithm to understand "how os checks that TRIM is supported and executed".
3) Another proof. First what we noted is reverting performance via synthetic test back to original. Another - is using "hdparm" method. Booted in linux, mount SSD with HFS, creates small file in specific place and saves the info about address of sectors that contains that file. In linux TRIM is turned off for HFS. Boot to OS X and delete this file. Back to linux - check the address - and we see only zeros. TRIM is working.
(In theory any SSD that supports TRIM should work but he later wrote with results of more testing)
Some more information about activated TRIM tests with other SSDs. These models tested and TRIM verified working:
- Kingston V+ SSDNow Series
- Intel X25-S/M 2nd Gen Series
- Western Digital Silicon Edge Blue Series
- OCZ Agility 2 Series
- OCZ Vertex Series
Thanks to Viktor for taking the time to send this. (Another reader replied he also used this tip successfully. He used file from a new 2011 MacBook Pro's 10.6.7 (10J3250). Does not work with the standard build of 10.6.7 (10J869) nor std 10.6.6 builds, as Viktor noted above he used 2011 MacBook Pro 10.6.6 file.)
I suspect someone will post an already edited file for download. (BTW - IME, anytime you edit a system file it's a good idea to run Repair Permissions from Disk Utility and reboot.)
(Update - on Saturday (3/26/11) a MR forum member created a utility to do the patching - not tried it personally but link sent was http://groths.org/zeus/TRIMEnabler.zip)
(Update 2: In fall 2012, another utility was released to enable TRIM, disable sleep image file and more that reportedly works with OS X 10.8/Mountain Lion also - see our page of Chameleon SSD Optimizer user feedback.)