Samsung 840 Pro - Trim

Discussion in 'Mac Pro' started by xWhiplash, Feb 17, 2014.

  1. xWhiplash macrumors 65816

    Joined:
    Oct 21, 2009
    #1
    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?
     
  2. Gav Mack macrumors 68020

    Gav Mack

    Joined:
    Jun 15, 2008
    Location:
    Sagittarius A*
    #2
    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.
     
  3. xWhiplash thread starter macrumors 65816

    Joined:
    Oct 21, 2009
    #3
    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.
     
  4. Gav Mack macrumors 68020

    Gav Mack

    Joined:
    Jun 15, 2008
    Location:
    Sagittarius A*
    #4
    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!
     
  5. xWhiplash thread starter macrumors 65816

    Joined:
    Oct 21, 2009
    #5
    I always keep mine about 50% full, MAYBE 70% in some cases. I try to avoid getting it to 80% full though.
     
  6. Cindori macrumors 68040

    Cindori

    Joined:
    Jan 17, 2008
    Location:
    Sweden
    #6
  7. hfg macrumors 68040

    hfg

    Joined:
    Dec 1, 2006
    Location:
    Cedar Rapids, IA. USA
    #7
    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! :)
     
  8. Gav Mack macrumors 68020

    Gav Mack

    Joined:
    Jun 15, 2008
    Location:
    Sagittarius A*
    #8
    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!
     
  9. Cindori macrumors 68040

    Cindori

    Joined:
    Jan 17, 2008
    Location:
    Sweden
    #9
    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.

    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/
     
  10. Studio K macrumors 6502

    Studio K

    Joined:
    Feb 17, 2013
    Location:
    United States
    #10
    From where did you run the Disk Repair? Was it another SSD or HDD?
     
  11. hfg macrumors 68040

    hfg

    Joined:
    Dec 1, 2006
    Location:
    Cedar Rapids, IA. USA
    #11
    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
     
  12. MatthewAMEL macrumors 6502

    MatthewAMEL

    Joined:
    Oct 23, 2007
    Location:
    Orlando, FL
    #12
    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.
     
  13. k-hawinkler macrumors member

    k-hawinkler

    Joined:
    Sep 14, 2011
    #13

    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.
     
  14. cal6n macrumors 68000

    cal6n

    Joined:
    Jul 25, 2004
    Location:
    Gloucester, UK
    #14
    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.
     
  15. slughead macrumors 68040

    slughead

    Joined:
    Apr 28, 2004
    #15
    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?
     
  16. AidenShaw macrumors P6

    AidenShaw

    Joined:
    Feb 8, 2003
    Location:
    The Peninsula
    #16
    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.
     
  17. theSeb macrumors 604

    theSeb

    Joined:
    Aug 10, 2010
    Location:
    Poole, England
  18. AidenShaw macrumors P6

    AidenShaw

    Joined:
    Feb 8, 2003
    Location:
    The Peninsula
    #18
  19. theSeb macrumors 604

    theSeb

    Joined:
    Aug 10, 2010
    Location:
    Poole, England
    #19
  20. MatthewAMEL macrumors 6502

    MatthewAMEL

    Joined:
    Oct 23, 2007
    Location:
    Orlando, FL
    #20
    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

    ----------

    Fine if you only do it once. Really bad idea if you do it more than once.
     
  21. AidenShaw, Feb 19, 2014
    Last edited: Feb 19, 2014

    AidenShaw macrumors P6

    AidenShaw

    Joined:
    Feb 8, 2003
    Location:
    The Peninsula
    #21
    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*.
     
  22. MatthewAMEL macrumors 6502

    MatthewAMEL

    Joined:
    Oct 23, 2007
    Location:
    Orlando, FL
    #22
    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.
     
  23. kennyman macrumors regular

    Joined:
    May 4, 2011
    #23
    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.
     
  24. slughead macrumors 68040

    slughead

    Joined:
    Apr 28, 2004
    #24
    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?
     
  25. AidenShaw, Feb 20, 2014
    Last edited: Feb 20, 2014

    AidenShaw macrumors P6

    AidenShaw

    Joined:
    Feb 8, 2003
    Location:
    The Peninsula
    #25
    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.
     

Share This Page