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

Ethosik

Contributor
Original poster
Oct 21, 2009
8,189
7,176
I have a Crucial M4 128GB WITHOUT trim at the moment. I have been running them for over a year with no issues.

However, I do have Bootcamp going on a DIFFERENT SSD, is Windows taking care of the OS X drive whenever I boot to my Windows? I am not sure how trim works. Does trim only work when you write to the disk? Or does just having the drive recognized in Windows 8 running trim in the background?

I have purchased the Samsung 840 Pro 256GB for a replacement. Do I need to enable trim for my new SSD?
 
You should enable trim if your version of OSX supports it. Think you said on the power cut post you had 10.6.8 so you will need to find trim enabler 1.0. Your M4 will probably need garbage collection so after enabling it and rebooting disable energy saver and leave it running overnight.

Windows will manage trim on its NTFS volume fine but will not manage HFS+ partitions.
 
You should enable trim if your version of OSX supports it. Think you said on the power cut post you had 10.6.8 so you will need to find trim enabler 1.0. Your M4 will probably need garbage collection so after enabling it and rebooting disable energy saver and leave it running overnight.

Windows will manage trim on its NTFS volume fine but will not manage HFS+ partitions.

I have not noticed any performance issues on my Crucial M4 since when I purchased it and trim has never been enabled.

I am running Mavericks.
 
I have not noticed any performance issues on my Crucial M4 since when I purchased it and trim has never been enabled.

I am running Mavericks.

With mavericks just download and run the latest trim enabler app. The later versions of M4 firmware run fine with trim enabled with OSX, it was just the early revisions of M4 firmware they had problems with the Mac and trim.

Unless the drive runs over 80% full degradation when not running trim is that noticeable, it's a gradual decline in performance. After the drive has had garbage collection though if never been done before you should definitely notice the difference!
 
With mavericks just download and run the latest trim enabler app. The later versions of M4 firmware run fine with trim enabled with OSX, it was just the early revisions of M4 firmware they had problems with the Mac and trim.

Unless the drive runs over 80% full degradation when not running trim is that noticeable, it's a gradual decline in performance. After the drive has had garbage collection though if never been done before you should definitely notice the difference!

I always keep mine about 50% full, MAYBE 70% in some cases. I try to avoid getting it to 80% full though.
 
Check out the benchmark graph at the bottom, it's for a Samsung 840. It should give you a good idea of the benefits. There's also some information about how Trim works.

http://www.cindori.org/software/trimenabler/

Hi Cindori .... perhaps you would know.

I recently used Mavericks DiskUtility to "Repair Disk" on a SSD. At the very end of the status messages, it said it was "Trimming unused blocks" just before it finished. Is that performing a forced Trim to reset all of the blocks, in effect "clearing" a empty SSD making it ready for full speed reuse? I think it only showed up when repairing the logical drive, not the top physical drive in DiskUtility.

I have never noticed this message before ... perhaps a quiet update to the latest version?


Thanks! :)
 
Cindori - any chance of telling me where trim enabler 1.0 is on your site for snow leopard. Save me emailing or dropbox'ing my copy if I could send a link!
 
Hi Cindori .... perhaps you would know.

I recently used Mavericks DiskUtility to "Repair Disk" on a SSD. At the very end of the status messages, it said it was "Trimming unused blocks" just before it finished. Is that performing a forced Trim to reset all of the blocks, in effect "clearing" a empty SSD making it ready for full speed reuse? I think it only showed up when repairing the logical drive, not the top physical drive in DiskUtility.

I have never noticed this message before ... perhaps a quiet update to the latest version?


Thanks! :)

This has always been done, but I was not aware you could view the message in Disk Utility now in Mavericks. Previous OSX required booting into single user mode and running fsck manually. It is indeed the Trim command but I'm not so sure it can be described as clearing all of the SSD. For that purpose the Erase Free Space feature might work better. This will (theoretically) make sure your SSD is trimmed, but leave your data intact.

Cindori - any chance of telling me where trim enabler 1.0 is on your site for snow leopard. Save me emailing or dropbox'ing my copy if I could send a link!

You don't need 1.0, the 2.2 version is the latest version which still works on 10.6.8. There's a link on the software page, just below the Download/Buy buttons:

http://www.cindori.org/software/trimenabler/
 
Hi Cindori .... perhaps you would know.

I recently used Mavericks DiskUtility to "Repair Disk" on a SSD. At the very end of the status messages, it said it was "Trimming unused blocks" just before it finished.
Thanks! :)

From where did you run the Disk Repair? Was it another SSD or HDD?
 
From where did you run the Disk Repair? Was it another SSD or HDD?

I ran DiskUtility from the OS X boot SSD on a MacMini and iMac and was cleaning off several external SSDs using a portable Thunderbolt enclosure. These SSDs had been used for testing external Windows boot and OS X and I ran the disk repair simply to be sure they were in good condition to reuse (they were Samsung 840 Pros and some OWC units).



-howard
 
For that purpose the Erase Free Space feature might work better. This will (theoretically) make sure your SSD is trimmed, but leave your data intact.

What? When did Apple update the 'Erase Free Space' command to TRIM/GC SSD's?

Just writing '0's to an SSD until full is the fastest way to wear it out.

Referring to the KB article you posted it specifically states:
Note: With OS X Lion and an SSD drive, Secure Erase and Erasing Free Space are not available in Disk Utility. These options are not needed for an SSD drive because a standard erase makes it difficult to recover data from an SSD. For more security, consider turning on FileVault 2 encryption when you start using the SSD drive.
 
What? When did Apple update the 'Erase Free Space' command to TRIM/GC SSD's?

Just writing '0's to an SSD until full is the fastest way to wear it out.

Referring to the KB article you posted it specifically states:
Note: With OS X Lion and an SSD drive, Secure Erase and Erasing Free Space are not available in Disk Utility. These options are not needed for an SSD drive because a standard erase makes it difficult to recover data from an SSD. For more security, consider turning on FileVault 2 encryption when you start using the SSD drive.


Apple didn't. After you overwrite the entire (free) space and switch on Trim Enabler the SSD will be reconditioned. I just did this. It works.
 
Apple didn't. After you overwrite the entire (free) space and switch on Trim Enabler the SSD will be reconditioned. I just did this. It works.

I do not enable TRIM under OS X and I recently reconditioned a Crucial M4 that had been part of a Fusion Drive setup, i.e. Pretty much full.

I was trying to reuse it as the system drive in an old MBP. I noticed that the install, while faster than an HDD was slower than I expected. So I bailed out of the install and, while still booted from the installer, erased the SSD (no overwrite). I then unmounted it and ignored it for about an hour, allowing Crucial's garbage collection to recondition it automatically. The install was lightning fast after that.
 
This has always been done, but I was not aware you could view the message in Disk Utility now in Mavericks. Previous OSX required booting into single user mode and running fsck manually. It is indeed the Trim command but I'm not so sure it can be described as clearing all of the SSD. For that purpose the Erase Free Space feature might work better. This will (theoretically) make sure your SSD is trimmed, but leave your data intact.

Interesting. My 3rd party SATA controller effectively turned off trim. I wonder if I can setup a cron job to run "erase free space" from the terminal to make up for this ? What do you think?
 
Don't erase free space per se

Invoking TRIM is a side effect of deleting the temporary file that filled free space - writing the zeroes did nothing (to an SSD, zeroes are very important data - just as important as any other data).

You can get the same effect by creating a large file, then deleting it - without adding to the wear on the SSD.

Be sure to use a tool that will allocate the space without writing to it. (If the tool doesn't return almost immediately, it's writing.) On Windows, the command "contig" can create such an empty file (it uses the same APIs used to make pagefile.sys and hiberfil.sys).

TRIM should also happen if both when you create a partition/volume and when you delete one. In both cases the OS knows that the data is unused and can TRIM it. If you want to TRIM unallocated space, just create a volume on it, then delete the volume.
 
On OS X the 'best practice' way is to enable FileVault 2 on the device and then format the drive after FileVault is active.

Secure Erase is not supported in OS X.

http://computers.tutsplus.com/tutorials/how-to-securely-format-your-ssd--mac-52349

----------

Apple didn't. After you overwrite the entire (free) space and switch on Trim Enabler the SSD will be reconditioned. I just did this. It works.

Fine if you only do it once. Really bad idea if you do it more than once.
 
Apple didn't. After you overwrite the entire (free) space and switch on Trim Enabler the SSD will be reconditioned. I just did this. It works.

Why wouldn't you enable TRIM *before* the overwrite?

Since the TRIM happens when the temporary file is deleted, if you delete the temp before turning on TRIM how does it do anything?

To the SSD, zeroes are perfectly valid user data that must be preserved. TRIM tells the SSD that blocks are *UNUSED* - that's very different from zeroed.
_____

Ah-Ah! I just thought of one possible explanation of why zeroing would improve performance. On SSD controllers that do compression (like Sandforce) the SSD could realize that blocks are unused even without TRIM. If you write a Gigabyte of zeroes, and they're stored compressed as 1 Megabyte - the controller would know that 999 MB are *UNUSED*.

Of course TRIM is better - it doesn't force you to write a huge amount to the disk, and garbage collection is easier because it knows which user-written blocks are now *UNUSED*.
 
Last edited:
Why wouldn't you enable TRIM before the overwrite?

Since the TRIM happens when the temporary file is deleted, if you delete the temp before turning on TRIM how does it do anything?

To the SSD, zeroes are perfectly valid user data that must be preserved. TRIM tells the SSD that blocks are *UNUSED* - that's very different from zeroed.
_____

Ah-Ah! I just thought of one possible explanation of why zeroing would improve performance. On SSD controllers that do compression (like Sandforce) the SSD could realize that blocks are unused even without TRIM. If you write a Gigabyte of zeroes, and they're stored compressed as 1 Megabyte - the controller would know that 999 MB are *UNUSED*.

Of course TRIM is better - it doesn't force you to write a huge amount to the disk, and garbage collection is easier because it knows which user-written blocks are now *UNUSED*.

Please listen to him.

SSD's aren't HDD's and require different things to get the best performance/longevity. Ignore this at your peril.
 
Enable Trim or not, it depends on your SSD and Controller. Regarding Samsung (I am talking about Samsung SSD), if you really want to keep your Samsung Pro for a long time; do 2 things; enable trim and always leave 30% of space free on your ssd.

Why? Because the product manager said so. And this was discussed a year ago.
 
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/mkfile.8.html

mkfile creates one or more files that are suitable for use as NFS-mounted swap areas. The sticky bit is set, and the file is padded with zeroes by default.

On mkfile:

OPTIONS
-n Create an empty filename. The size is noted, but disk blocks aren't allocated until data is
written to them.


Does this mean the file is truly empty and occupies the stated space?

Also, I don't have the ability to enable trim on my SSD, when I create and remove the file, are you telling me this will have an effect like TRIM or that it is a way of forcing trim on a previously untrimmed SSD (after trim is enabled)?

Finally, supposedly the Two Samsung 840 EVO's I'm using have built-in garbage collection.... I am skeptical, any idea if this is accurate?
 
On mkfile:

OPTIONS
-n Create an empty filename. The size is noted, but disk blocks aren't allocated until data is
written to them.


Does this mean the file is truly empty and occupies the stated space?

Also, I don't have the ability to enable trim on my SSD, when I create and remove the file, are you telling me this will have an effect like TRIM or that it is a way of forcing trim on a previously untrimmed SSD (after trim is enabled)?

Finally, supposedly the Two Samsung 840 EVO's I'm using have built-in garbage collection.... I am skeptical, any idea if this is accurate?

Try
mkfile -nv 10g tmp.tmp​

If it takes 20 seconds or more to complete (on fast SSD), it's zeroing the file. If it takes milliseconds, it's not.

If the free space on the disk dropped by 10 GiB, it allocated the file. If the free space stayed the same, it only changed the meta-data (it created a sparse file).

If you don't have TRIM, this just adds unnecessary wear to the drive - unless you have a compressing controller.

*All* SSDs have garbage collection - if they didn't they'd be "write once" drives. Write 128 GB to a 128 GB drive and it would stop working (actually, you'd probably be able to write 128 GiB due to over-provisioning).
_______

If you don't have TRIM, the key to keeping the drive fast is to over-provision - give the SSD controller a pool of free blocks to make garbage collection easier.

Your typical SSD comes with about 7% of the space over-provisioned. That 128 GB drive really has 128 GiB of flash, and the difference is the pool for GC. (128,000,000,000 bytes visible, 137,438,953,472 bytes actual, 9,438,953,472 bytes for the garbage collector.) Note that many drives made for heavier duty have higher levels of over-provisioning - for example a 120 GB drive probably still has 128 GiB of flash, but 8GB more in the GC pool. An enterprise drive may have 100 GB of the 128 GiB visible, with over 37 GB in the GC pool.

With TRIM, all free space on the volume is available for the GC - the pool expands and contracts as the free space changes. So, unless you run it almost full you have a huge GC pool.

If I had to run a drive without TRIM, I'd leave a hefty chunk of the drive unpartitioned to ensure a big GC pool.
  • If the drive isn't brand new (never used), run the drive's manufacturer's low level tool to mark the entire drive as *UNUSED*. "Secure Erase" usually does this, but check. (Or, connect the drive to a Windows 7 system, create a full-size NTFS volume, then delete the volume)
  • Partition the drive, leaving about 20% or more unused - paying attention to binary vs decimal arithmetic. (For that 128 GB drive with 128 GiB of flash, a 110 GB partition would leave about 20% of the 137 GB free.)
  • Never, ever read or write to the GC area. Once a block is used, only TRIM (or secure erase) can put it back to *UNUSED*. (Of course, you'd have to make a partition to use the GC pool.)
If you are interested in more details, the article http://en.wikipedia.org/wiki/Write_amplification has a good explanation of SSD operation, garbage collection and TRIM.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.