Jump to content

Activate TRIM support on any SSD


  • Please log in to reply
54 replies to this topic

#1
scrax

scrax

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,704 posts
  • Gender:Male
http://www.groths.org/?p=308
to download TRIM Enabler

Posted Image


or use this kext:
Attached File  IOAHCIFamily.kext.zip   217.82KB   320 downloads

Before:
Attached File  Schermata_2011_03_26_a_17.55.58.png   200.38KB   830 downloads
After:
Attached File  Schermata_2011_03_26_a_18.08.01.png   194.54KB   730 downloads

And for the terminal fans (like me):
sudo perl -pi -e 's|\x41\x50\x50\x4C\x45\x20\x53\x53\x44|\x00\x00\x00\x00\x00\x00\x00\x00\x00|g' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage

Note: TRIMEnabler will install a 2.0.5 IOAHCIFamily.kext like the one in the .zip that has INSIDE a binpatched IOAHCIBlockStorage.kext to enable TRIM support on any SSD not only on APPLE SSD.
The terminal command will be useful only if your system has in /S*/L*/E* a 2.0.5 IOAHCIFamily.kext installed so it will become useful only for future Osx updates (10.6.8 or 10.7)

#2
mrmojorisin17

mrmojorisin17

    InsanelyMacaholic

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 3,942 posts
  • Gender:Male
Great news scrax :(
It works also in SL 10.6.5?

#3
scrax

scrax

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,704 posts
  • Gender:Male
not tested, try the kext on a test installation. :(

#4
Cindori

Cindori

    InsanelyMac Protégé

  • Members
  • PipPip
  • 76 posts
it should work on any SL version, but don't take it as a fact until it's been done :D

#5
kmare

kmare

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 121 posts
  • Gender:Male
  • Location:Toronto
I believe this is working - my xbench stores have steadily improved today (Kingston G2) thanks!

#6
mrmojorisin17

mrmojorisin17

    InsanelyMacaholic

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 3,942 posts
  • Gender:Male

not tested, try the kext on a test installation. :)


I'll try it on my SL 10.6.5 and post here the results :D

#7
scrax

scrax

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,704 posts
  • Gender:Male

it should work on any SL version, but don't take it as a fact until it's been done :D

Hi Cindori, I wasn't aware you where registered here. Nice to know it. And thank's for your TRIMEnabler.

#8
Dr. C

Dr. C

    InsanelyMac Protégé

  • Members
  • PipPip
  • 88 posts
Thanks, works on a 10.6.6 without problems.

#9
morfy

morfy

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 890 posts
Thanks, works on a 10.6.7 without problems. How can I test really work?

#10
scrax

scrax

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,704 posts
  • Gender:Male

Thanks, works on a 10.6.7 without problems. How can I test really work?

you need to check how deleted file are handled using linux, here someone already did it:

Reader Notes/Tricks for 3rd party SSD OS X TRIM Support
(From a reader mail yesterday. I've not kept up with this subject for some time...)
"Subject: Third-Party TRIM SSD Support in Mac OS X
Hello Mike. 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.
Voila!
This is works on latest Mac OS X 10.6.7 and 10.7 Developer Preview.
-Viktor D.

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
-Viktor D."

Thanks to Viktor for taking the time to send this. (Another reader replied he also used Viktor's 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.)

Update: from Viktor Saturday afternoon:

" Hi again! Important update to mod info about enabling trim.
Instead of writing the name of desired SSD in IOAHCIBlockStorage binary, we can rewrite in hexadecimal table string APPLE SSD with (Hex) zeroes. In right (Hex) table where letters will be displayed as dots. What benefit of this? (vs SSD name) - This will work with any SSD Drive that supports TRIM. And not only for one model, even with different models/different mfrs/brands. Universal solution (for TRIM supporting SSDs) to this problem in other words.
-Viktor D."
I suspect someone will post an already edited file for download.
(Update - a MR forum member created a utility to do the patching - not tried it personally but the D/L is http://groths.org/ze...RIMEnabler.zip)

source: http://www.xlr8yourmac.com/index.html
(It's the article in the home at the moment but I can't find a direct link. Probably in future it will be difficult to find out so I quoted all the article here, just in case.)


I'll try to keep here a list of tested ssd so please contribute with your experience, posting sistem version and ssd type.

for now we have:

Crucial M225
Kingston V+ SSDNow Series
Intel X25-S/M 2nd Gen Series
INTEL SSD G2
Intel 510 SSD
INTEL SSDSA2M160G2GC
Western Digital Silicon Edge Blue Series
OCZ Agility 2 Series
OCZ Vertex Series
OCZ Vertex 2 Series
G-SKILL Falcon
OWC Mercury Extreme Pro SSD
OWC Mercury Aura Pro SSD

#11
magnifico

magnifico

    InsanelyMac Deity

  • Donators
  • 2,344 posts
  • Gender:Male
;) ;)
I have tried on two SSD vertex 2, but without the kext that you have in down, I have only replaced this.

Attached Files



#12
scrax

scrax

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,704 posts
  • Gender:Male

:) ;)
Hi Guy...

;)
that's more easy than OxED ;)

#13
magnifico

magnifico

    InsanelyMac Deity

  • Donators
  • 2,344 posts
  • Gender:Male

;)
that's more easy than OxED ;)


;)
Yes of course , ----------------- errata corrige

:)
Fantastic Result on my two SSD vertex 2 in raid 0
Tested on 10.6.6
Hey man sorry for my bad english

Attached Files



#14
scrax

scrax

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,704 posts
  • Gender:Male

:P :P
I have tried on two SSD vertex 2, but without the kext that you have in down, I have only replaced this.

The one you replaced is INSIDE the one I've posted.
I posted all the bundle because it is more easy to install.

#15
magnifico

magnifico

    InsanelyMac Deity

  • Donators
  • 2,344 posts
  • Gender:Male

The one you replaced is INSIDE the one I've posted.
I posted all the bundle because it is more easy to install.


ok, ok , now they are happy, for me the trim works well, but I must make the tests between a month in order to see if forgiveness in reading or writing

Posted Image
Posted Image

Great news scrax :P
It works also in SL 10.6.5?


No..sorry

it should work on any SL version, but don't take it as a fact until it's been done :P


Posted Image

Thank s

#16
mrmojorisin17

mrmojorisin17

    InsanelyMacaholic

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 3,942 posts
  • Gender:Male
I think I've to install SL 10.6.6 and his AppStore :P

#17
magnifico

magnifico

    InsanelyMac Deity

  • Donators
  • 2,344 posts
  • Gender:Male

I think I've to install SL 10.6.6 and his AppStore :P


:D :D
Delete Apple Store of Finder... :P

#18
scrax

scrax

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,704 posts
  • Gender:Male

I think I've to install SL 10.6.6 and his AppStore :P

Have you tried on 10.6.5 so? what didn't work?

#19
mrmojorisin17

mrmojorisin17

    InsanelyMacaholic

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 3,942 posts
  • Gender:Male

Have you tried on 10.6.5 so? what didn't work?


I didn't test yet because I don't have my hack at the moment.
magnifico says that don't work on SL 10.6.5 (Post #15) :P

#20
scrax

scrax

    InsanelyMac Deity

  • Members
  • PipPipPipPipPipPipPipPipPipPip
  • 1,704 posts
  • Gender:Male

I didn't test yet because I don't have my hack at the moment.
magnifico says that don't work on SL 10.6.5 (Post #15) :unsure:


The kext posted is like a driver with support for TRIM so it will not work only if there is something else that break it. I think that on 10.6.5 it could work. If I can I'll try it on 10.6.4 but before I have a lot of other works to do.

P.S.:
I belive that Magnifico sad that because of the subtitle of this topic, for what I know he doesn't have a 10.6.5 build to test it.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy