Pages

Upgraded your Mac to an SSD? Enable TRIM

As I wrote last week, the SSD upgrade for my Mac Pro went very smoothly. There were two important things I found out after I started reading the comments from that entry:
  1. An SSD is a good performance upgrade but the OWC Mercury Accelsior_E2 provides incredible performance. Though quite a bit more expensive than a standard SSD, if you want the absolute best performance for a Mac Pro you may want to consider it. At 820MB/s it is over 5 times faster than the SSD I just installed. Hat tip to Eytan for pointing this out to me.
  2. After adding a 3rd party SSD to your Mac, you need to investigate TRIM support. Derek brought up the issue in the comments and I spent some time investigating it.

What is TRIM?

TRIM is effectively a garbage collection model for SSDs. There is some great information on it on Wikipedia’s TRIM entry. The bottom line is that without TRIM enabled the performance of an SSD will suffer over time. This is something you’ll want to address.

I contacted Crucial technical support to ask if the Crucial 512GB M4 SSD I purchased supported TRIM. Crucial told me I had two options: occasionally "clean" the SSD or enable the operating system to send TRIM commands to the drive. The cleaning process sounds... tiresome. You restart your Mac every couple of weeks, holding down the Option key during the reboot, then let it sit at the boot menu for 24 hours as the firmware cleans the SSD.

You can however turn on TRIM support through a series of Terminal commands and script execution or by using a free utility called Trim Enabler.

Trim Enabler - just turn it on
Running Trim Enabler is pretty simple. Download and install it from the provided DMG and then flip the main toggle button to On. Once this is done you will need to reboot your Mac and TRIM will be enabled. You can confirm this by checking your System Information application and looking at the Serial-ATA entry for your SSD:

TRIM Support is enabled
Based on this information available you will need to restart and run Trim Enabler again if you upgrade OS X to the next point release. If you’re not sure, after an upgrade simply check System Information to ensure TRIM is enabled.

Got a tip for maximizing SSD performance? Drop a note in the comments!

Update: I always get the best comments. In case you don't read them, Hendrik pointed out that not all SSDs are created equal and that Sandforce based SSDs have built in garbage collection baked in. OWC SSDs in particular should not run Trim Enabler. Your mileage may vary. Clearly for the Crucial SSD I installed it's needed but if you install an SSD check with your manufacturer to see if it needs TRIM enabled in the OS.

22 comments:

Tommi said...

I've upgraded to SSD and I didn't know about this. I thought Mac support to this automatically.

Thanks for information

David Alison said...

@Tommi: Yeah, I did as well. Apparently as of right now Apple only turns on TRIM support for SSD that come with an Apple device (MB, MBP, Mac Pro, etc). You do need to check w/ your SSD vendor to ensure the drive supports TRIM, otherwise you'll likely need to go through a periodic cleanup.

Anonymous said...

Keep pesting Apple to enable it for all drives please.

www.apple.com/feedback

Eytan said...

David, the 820 GB/s speed is not achievable as far as I can see with any of Apple's (current) hardware. It may be achievable with an external Thunderbolt PCI expansion chassis for the Ivy Bridge machines...

The Mac Pros are a max of 685 GB/s. This is nothing to sneeze at, and certainly faster than what you are seeing now, but it is not the maximum 820 GB/s the card can realizes.

BobM said...

Dave,
Talking about SSD's..
If your SSD size is not big enough to store all you want, you may want to consider an SSD enlargement.. oops.. wrong ad.. :-)

Check out Mountain lion's SSD fusion setup, this gives you a huge Hard drive with fast access. I run it on my MacBookPro, and have been real happy with it. I have a 1TB volume split between a 250 SSD and a 750HD.

This allows the mac to use the SSD as a high speed drive, but uses the standard Hard drive as additional storage for infrequent accessed data. It keeps a write buffer to handle write requests fast, and as long as the read is in the SSD, it is real fast. If you end up reading from the HD, it may put it onto the SSD for future use, depending on how often you access it.

links..
JollyJinx Fusion Setup

Tomasz Korwel's Blog

Oh, and yes, I turned on Trim for this setup. It may not be as fast as your Retina MacBookPro, but it does well for a standard Laptop

David Alison said...

@BobM: Interesting - had heard about the fusion setup but hadn't done any reading on it. When I was researching storage options I did look at the Seagate Hybrid drive, which is supposed to be a fusion of SSD and traditional HD technologies, but decided to just go with a larger SSD (512GB) instead. I also installed a 3TB NAS from Synology to handle my larger storage needs.

Hendrik said...

Careful: The TRIM enabler hack is not without risks.
On Sandforce based SSDs, TRIM is apparently both unnecessary (because they have good garbage collection) and can often lead to issues like freezing / beach balling during disk access.

Hendrik said...

Here is the recommendation from OWC regarding TRIM:
http://blog.macsales.com/11051-to-trim-or-not-to-trim-owc-has-the-answer

BobM said...

About those Seagate Hybrid drives.. The problem with them is they don't have enough space to be effective. it has only 8GB of flash, which may give a small buffer, it's not enough room to cache all of your most frequent data and applications. If they had 128 or maybe 64, you probably talking enough to not notice it most of the time.

With 512GB SSD you likely don't need this, but I don't know how much data you have. I run a 1.5TB time machine (makes me worried based on your prior post) and the 1TB fusion drive. it is slick and fast. The conversion setup is actually pretty fast(<10 minutes of actual operations, most of that to read the directions through a couple times).. The longest part was the backup and restoring the data. (I set that up and walked away.. I didn't time that part)

I just love the fact that the managing of the data on which partition occurs with no thought on my part.. It just organizes the blocks by the ones I use the most, and promotes them to the SSD.

David Alison said...

@Hendrik: As always, thanks for the great information. I updated the blog post recommending people take a look in these comments.

I've received a lot of traffic on this post already and I'm surprised that there isn't a definitive way for this getting addressed, given that SSDs and SSD upgrades have been popular for quite a while now.

@BobM: Yup, that's one of the reasons I didn't go with them. The other is that the drive that of the two drives that failed on me this year both were Seagates and lately I've been more of a Western Digital fan.

I've been able to lay out my data in a way that works with an SSD / NAS approach moving forward. It's one of the blog posts I have planned for later in the week.

Dan said...

Awesome to see you blogging again Dave. Been awhile. :)

Thanks for the info. The company I worked for had purchased a new Retina MBP for me and it has a 500 gb SSD. It's ridiculous how fast this thing is compared to my 2010 MBP. But like you, I was afraid of the "degradation" factor. Thanks for the info. My fears have been relieved knowing Apple has TRIM enabled by default. I checked and it is also enabled on my mbp.

David Alison said...

@Dan: Thanks man - good to be blogging again. Just make sure you check with your SSD manufacturer to ensure it supports TRIM!

Paul Russo said...

Hi David,

I have to agree with Hendrik:
> Careful: The TRIM enabler hack is not without risks.

Another risk of this hack is that it does not, in reality, turn on support for TRIM. What it actually does, is to *patch* Apple's IOAHCIBlockStorage driver to remove the check for an Apple SSD, stopping the driver from turning off TRIM.

This might seem like splitting hairs, but it is an important distinction. What it means is that it relies on this patched copy of the driver to remain intact. The problem is that during a software update, the patched Apple driver is likely to be overwritten with the newest version, removing the patch.

Now that the old driver has been replaced, TRIM is no longer on. It might be a long time before you notice.

Here are some questions that I have not been able to find an answer to:

What is the effect of having TRIM on, then off for a while, then back on again? Does having TRIM off for a while affect the optimization for which TRIM is designed.

Also, what is the effect of copying files to the SSD, then turning TRIM on, as opposed to turning TRIM first then doing the copy. This is a similar question as the one above.


Description of the patch: http://www.storagereview.com/how_to_enable_trim_with_nonapple_ssd

http://macenstein.com/default/2012/06/whoops-remember-to-re-enable-trim-support-on-your-macs-ssd-drive-every-once-in-awhile/

TRIM is designed to deal with the complex issue the how traditional storage blocks are affected by the odd way that these blocks are mapped on an SSD, and SSD garbage collection. I haven't found any source that seems to understand how all these issues affect each other.

David Alison said...

@Paul Russo: some good information there, thanks. While I don't like the idea of having to enable TRIM myself (yes, hacking an internal config), running without TRIM means that my SSDs performance will gradually degrade. Apple really should address this without us having to resort this.

From what I understand any data removed while TRIM is not running (at least on the SSD I bought), is effectively fragmented. TRIM works during deletes so you would need to let the drive go through a cleaning process in order to clear up the problems.

Proximo said...

Hendrik said...
Careful: The TRIM enabler hack is not without risks.
On Sandforce based SSDs, TRIM is apparently both unnecessary (because they have good garbage collection) and can often lead to issues like freezing / beach balling during disk access.
May 20, 2013 at 10:08 PM

I have an OWC Mercury Elektra SSD and chose to turn on Trim Enabler on my MacBook…. simply because the Mac would freeze w/spinning ball without it enabled. After initial installation of the SSD, I read the info at the OWC site about not needing it, but the Mac would not behave unless it was on. Go figure. Am I doing any damage?

Proximo said...

Hendrik said...
Careful: The TRIM enabler hack is not without risks.
On Sandforce based SSDs, TRIM is apparently both unnecessary (because they have good garbage collection) and can often lead to issues like freezing / beach balling during disk access.
May 20, 2013 at 10:08 PM

I have an OWC Mercury Elektra SSD and chose to turn on Trim Enabler on my MacBook…. simply because the Mac would freeze w/spinning ball without it enabled. After initial installation of the SSD, I read the info at the OWC site about not needing it, but the Mac would not behave unless it was on. Go figure. Am I doing any damage?

Esmael Ostadi said...

Thank you so much Davis. I was not even aware that one needed to have a TRIM support on a SSD. I just installed one on my Early 2009 Macbook; boots in <30seconds. I am still confused as to what type of SSD I should have installed. Mine is a Sandisk Ultra PLus SATA III, but I hear that I needed a SATA II. Do yo have any advise on this. Thanks Esmael

Anonymous said...

I found out the hard way about Trim. You must have this enabled and always check after apple updates that it did not turn it off. Otherwise your SSD will crash on you. I upgraded about 20 imac at work with SSD. All of the sudden in one day 4 of them went down. I did my research and it was because of Trim. When you redo your system it is best to zero out your hard drive before reinstalling the os. I am using trim enabler as we speak. So far no complaints everything is running smooth.

James Katt said...

@ Eytan: Using current Mac Pros (not the new Mac Pro 2013), the maximum read speed with a PCIe SSD is 1800 Megabytes per second. The maximum write speed is 1500 Megabytes per second.

Lloyd Chambers proved this using an OWC Mercury Accelsior PCIe SSD with a Triple RAID-0 Stripe. See his results:

http://macperformanceguide.com/Reviews-SSD-OWC-Mercury-Accelsior-speed-fill-volume-stripe3.html

James Katt said...

I have serious problems with the reasoning behind OWC's recommendation against turning on TRIM for their SSDs.

1. If TRIM is dangerous to OWC's SSDs WHY IS THIS NOT ADVERTISED PROMINENTLY? After all, if TRIM shortens the lifespan of the OWC SSD, isn't this dangerous for the warranty? Isn't this dangerous to your data? There should be a prominent Black Box Warning just like on medications where death is a possible side effect. I would hate to lose data because TRIM is turned on.

2. Why would Sandforce representatives state that TRIM is good and compatible with Sandforce controlled SSDs like OWC's?

3. Are OWC's SSDs incompatible with Windows PCs where TRIM is automatically turned on?

4. Are OWC's SSDs incompatible with SSDs from other brands since other brands need TRIM and OWC's SSDs are incompatible with TRIM? Thus if you use an OWC SSD you are locked in to using OWC's SSDs since its SSDs are incompatible with TRIM.

Since my OWC SSD has a 5 year warranty and avoiding TRIM or use on Windows PCs or in mixed SSD brand PCs is not prominently advertised, I think their reasoning has flaws.

James Katt said...

One point about SSDs:

When an SSD fails it does so suddenly and without warning. They don't make noises like hard drives do. When when they fail, all the data on them is totally lost.

That has been my experience.

So backup, backup, backup.

I back up to external SSDs so that I can install them in minutes when the internal SSD fails.

J. Bernstein said...

So glad I found your blog again David! Today, installed a Crucial 256GB SSD on mid-2010 MBP so wanted to read up on TRIM. I'l probably write a Pi article (mostly about the merit of mounting the SSD in a drive toaster, then installing Mac OS and restoring TM backup, and make sure the SSD is working fine as a boot drive before swapping it for the original internal HD) so will definitely want to link to your blog about the TRIM issue. If you're able to debunk the whole business of OWC "don't"and Sand force "do" that would be helpful.