13 Replies Latest reply: Dec 9, 2013 8:58 AM by The hatter
The hatter Level 9 Level 9 (58,880 points)

  How Trim Works -
The OS sends a TRIM command at the point of file deletion
The SSD marks the indicated locations as invalid data
TRIM Features:
► Prevents GC on invalid data
► Increases the free space known to the SSD controller
TRIM Benefits:
► Higher throughput – Faster host write speeds because less time writing for GC
► Improved endurance – Reduced writes to the flash

Lower write amplification – Less data rewritten and more free space is available

 

The OS tracks what files are present and what logical blocks are holding the files


SSDs do not understand the file structure of an OS; they only track valid data locations reported by the OS


When the OS deletes a file, it marks the file’s space in its logical table as free - It does not tell the drive anything


When the OS writes a new file to the drive, it will eventually write to the previously used spaces in the table


An SSD only knows data is no longer needed when the OS tells it to write to an address that already contains data

 

All SSDs will have some form of GC – it is not an optional feature

 

NAND flash cannot directly overwrite a page with data; it has to be first erased

 

One full block of pages has to be erased, not just one page

 

GC starts after each page has been written one time

 

Valid data is consolidated and written into new blocks

 

Invalid (replaced) data is ignored and gets erased

 

Wear leveling mainly occurs during GC

 

Garbage Collection (GC) is the process of relocating existing data, deleting stale data, and creating empty blocks for new data

 

 

TRIM SSD and GC

The SATA 3.1 specifications Queued Trim Command - allows SATA SSDs to execute Trim without impacting normal operation...

http://www.sata-io.org/technology/6Gbdetails.asp

Wikipedia SSD:

"includes support for the TRIM command to reduce garbage collection for data which the operating system has already determined is no longer valid. Without support for TRIM, the SSD would be unaware of this data being invalid and would unnecessarily continue to rewrite it during garbage collection causing further wear on the SSD."

https://en.wikipedia.org/wiki/Solid-state_drive

https://en.wikipedia.org/wiki/TRIM

http://en.wikipedia.org/wiki/Write_amplification


 



Mac Pro, Mac OS X (10.7.5), ATI 5770 16GB Samsung SSD Sonnet 6G
  • 1. Re: SSD Maintenance
    The hatter Level 9 Level 9 (58,880 points)

      Trim on SSD Drives

       this a generalization of most ssd drives

     

      What trim does is mark these blocks/files etc and make it simpler for the inbuilt GC ( garbage collection ) to recognize the blocks that are available for further use, on some controller’s this will not necessarily happen immediately, it depends on whether the controller as been designed for “idle” use, “on the fly” use or “stand by use”, GC/Trim can be brought into use in many different ways, having the computer sitting with the bios open, having the computer idling at log in, placing the computer in stand by mode, deleting files or just simple idling the computer overnight. It’s a matter of finding out how the controller in your particular ssd handles the garbage collection. You will find the most efficient way is by experimentation or by other members passing on there particular way of doing it.

     

    Low level formatting used on conventional HDD drives writes mainly 0’s to every cell on a SSD drive, it’s the opposite to how flash memory actually works, if you low level format with Win7 or any software that writes 0’s or 0’s and 1’s to the individual cells, you are not necessarily cleaning the ssd drive completely, ( hence the need for secure erase software ), you can actually make the performance worse.

     

    If you use software designed for writing 1’s to each cell, like you would if it was designed for ssd drives, this will “clean” the drive and is a good thing to do if you are selling the drive, or as a last resort, if you are having problems with your ssd drive. The downside of using this type of erasure, is that it not only takes a long time it uses high write amplification and if used regularly can reduce the flash cells life expectancy considerably, these type’s of deletions bypass most controllers durawrite capabilities ( the way controllers extend the life expectancy of the ssd’s individual MLC cells ), Durawrite ( Sandforce ), other controllers have this technology in some form or other, it increases MLC life expectancy by between 5 and up to 30 times depending on the design of the controller.

     

     

    TRIM occurs when the ssd clears blocks of invalid data.  When you delete a file, the operating system will only mark the area of the file as free in order to trick the system into believing the space is available. Invalid data is still present in that location.  Its like ripping out a Table of Contents from a book.  Without this, one would not know what, if anything, is contained on the following pages.  TRIM follows the process of marking the area as free by clearing the invalid data from the drive.  Without this, the process of reading, identifying invalid data, deleting or moving and clearing the block before writing can actually result in performance 4 times slower than it would have normally been as a new drive.

     

    In recently speaking with Kent Smith, Sr. Director of Product Marketing  for SandForce, he identified that there are many variables outside of the hardware that are responsible for users not seeing the benefits of TRIM, the first of which are drivers at the OS level which have to be working optimally in order for TRIM to function correctly. 

     

    Another example occurred with early Windows 7 users testing their newly installed drives and not seeing the benefits of TRIM.  Examination of these complaints revealed that users would have originally made the Windows 7 installation on hardware that did not support TRIM and then cloned to the SSD to which TRIM was supported but would not work because of the original configuration settings. 

     

    The same could be said of cloning an OS that originally had AHCI turned off followed by a clone to the SSD where TRIM was not being passed, simply because AHCI has to activated for TRIM to function.

     

       Filling a drive to capacity will hinder TRIM and GC ability which will result in performance degradation. Many drives will start to display performance changes once filled to 70% capacity.

     

      Now, I want to be clear, a sufficiently clever GC on a drive that has enough reserved space might be able to do very well on its own, but ultimately what TRIM does is give a drive GC algorithm better information to work with, which of course makes the GC more effective.

     

      http://www.devwhy.com/blog/2009/8/4/from-write-down-to-the-flash-chips.html

  • 2. Re: SSD Maintenance
    The hatter Level 9 Level 9 (58,880 points)

    Before you clone, install TRIM Enabler

     

    And after you clone, run Disk Utility's REPAIR DISK on the SSD -- just to be on the safest side.

    http://www.macupdate.com/app/mac/37852/trim-enabler

     

    Trim is must-have feature for most Solid State Drives. It not only increases data writing speeds, but it increases the lifetime of the SSD itself. With Trim Enabler, you can bring that feature to Mac OSX. It’s as easy as flipping a switch.

    Trim Enabler can also analyze your drive and show information about it’s health and show lifetime statistics.

    http://www.groths.org/trim-enabler/

  • 3. Re: SSD Maintenance
    Ralph Landry1 Level 7 Level 7 (32,445 points)

    Great, are you going to make a Tip out of this?  I am getting tired of Bookmarking, Deleting, Bookmarking

  • 4. Re: SSD Maintenance
    The hatter Level 9 Level 9 (58,880 points)

    Looking for input from you and others. I dropped out of tipping

  • 5. Re: SSD Maintenance
    Ralph Landry1 Level 7 Level 7 (32,445 points)

    Haven't taken the time to read all the details but wanted it bookmarked so I could come back to it...will print this thread now so I can stop and do some reading.  If you do not tip at least 18% forget it

  • 6. Re: SSD Maintenance
    The hatter Level 9 Level 9 (58,880 points)

    Adding 1TB of SATA3 SSD with Apricorn and Highpoint RAID to my 2009 MP

     

    http://forums.macrumors.com/showthread.php?t=1504491

     

     

    Real world experiences with Sonnet Tempo Pro and 2 Samsung 840 Pro SSDs

     

    http://forums.macrumors.com/showthread.php?t=1605500

  • 7. Re: SSD Maintenance
    The hatter Level 9 Level 9 (58,880 points)

    Samsung has new firmware for the 840 120GB - use Samsung Magician (v. 4.1) on Windows to get it.

  • 8. Re: SSD Maintenance
    The hatter Level 9 Level 9 (58,880 points)
    Samsung SSD 840 EVO Review: 120GB, 250GB, 500GB, 750GB & 1TB Models Tested

    http://www.anandtech.com/show/7173/samsung-ssd-840-evo-review-120gb-250gb-500gb- 750gb-1tb-models-tested

     

    9 months after the release of the Samsung SSD 840 and we have its first successor: the 840 EVO.

     

    The non-Pro version of the 840 was the first large scale consumer SSD made with 3-bit-per-cell MLC NAND, more commonly known as TLC (triple-level-cell) NAND. Companies had toyed with the idea of going TLC well before the 840's release but were usually stopped either by economic or endurance realities. The 840 changed all of that. Although it didn't come with tremendous cost savings initially, over time the Samsung SSD 840 proved to be one of the better values on the market - you'd just have to get over the worry of wearing out TLC NAND. 

    Despite having a far more limited lifespan compared to its 2bpc MLC brethren, the TLC NAND Samsung used in its 840 turned out to be quite reliable. Even our own aggressive estimates pegged typical client write endurance on the 840 at more than 11 years for the 128GB model.

     

    The cores now run at 400MHz compared to 300MHz previously, which helps enable some of the higher performance on the EVO.

     

    The MEX controller also sees an update to SATA 3.1, something we first saw with SanDisk's Extreme II. SATA 3.1 brings a number of features, one of the most interesting being support for queued TRIM commands.

     

    TurboWrite does a good job of blurring the lines between MLC and TLC performance, while Samsung's RAPID DRAM cache offers adventurous users a way of getting a taste of high-end PCIe SSD performance out of an affordable TLC SATA drive. 

    The 1TB version is exciting because it offers a competitive price with the 960GB M500 but with better performance.

     

    Samsung expects the 840 EVO to be available in the channel at the beginning of August.

     

    Samsung SSD 840 EVO120GB250GB500GB750GB1000GB

     

                                                $109.99$189.99$369.99$529.99$649.99
  • 9. Re: SSD Maintenance
    Electricidad Level 1 Level 1 (70 points)

    Hatter, your "tip" is obsolete. Modern SSDs do not need TRIM enabled. They have their own internal data management.

  • 10. Re: SSD Maintenance
    The hatter Level 9 Level 9 (58,880 points)

     
    There is an update on the Samsung site to firmware DXT08B0Q.

    They even provide a Mac version with instructions here:

  • 11. Re: SSD Maintenance
    The hatter Level 9 Level 9 (58,880 points)

    I posted above already about SATA 3.1 Which incorporates how NCQ and TRIM are being handled.

     

    TRIM SSD and GC

    The SATA 3.1 specifications Queued Trim Command - allows SATA SSDs to execute Trim without impacting normal operation...

    http://www.sata-io.org/technology/6Gbdetails.asp

    Now everyone may not have a new enough SSD and who knows what Mac OS they use and to me whether that has any interference or not.

    If you have a list of which SSD incorporates or not TRIM in the controller and firwmare that would be a positive contribution. Yours was not.

  • 12. Re: SSD Maintenance
    The hatter Level 9 Level 9 (58,880 points)

    Russ Arcuri - Macintouch commentary

    RE: Michael Diehr's commentary about TRIM.

    I can only assume Michael was not around for the previous discussions about TRIM here, during which each and every objection he raises was hashed out.

     

    So-called "sophisticated" or "advanced" garbage collection only exists because TRIM-like technology didn't exist already, being unnecessary for use with spinning magnetic media. Something had to be done to allow SSDs to work properly with drive interfaces, filesystems and operating systems that were optimized for use TRIM directly addresses the shortcomings of having only garbage collection available. SSD controller manufacturers and designers (including SandForce, the controller manufacturer for OWC's SSDs), recommends that TRIM be used with their products. So does Samsung.

    For example, here's a 2011 article from OWC describing how you don't need TRIM on their SSDs and how it can in fact hurt performance or reliability.

    That article has been discussed here on MacInTouch before. In my opinion it's bad advice, and inaccurate in some of its assertions. It also ignores the recommendation made by SandForce to use TRIM with their SSD controllers. But even if one were to take that article at face value, applying that advice to SSDs other than OWC's makes little sense.

    The reason I'm advising against TRIM is simply that it's yet another driver-level modification of the OS, and these always carry potential risk (as all the folks with WD hard drives who lost data can attest to).

    Apples and oranges comparison, for a variety of reasons. The short of it is that TRIM is supported natively in all recent versions of OS X. The tools used to enable it for third party SSDs do not add a new kernel extension; they change the setting to allow Apple's native TRIM implementation to be used with SSDs other than those factory installed by Apple.

    This shows that the 840s do work slightly better with TRIM than without, but the differences are (in my opinion) trivial, a 9% increase at best.

    One of the major reasons for the skepticism that exists about TRIM is that so many people, the authors of both articles you linked to included, don't understand it.

     

    TRIM is not, strictly speaking, a performance-enhancement technology -- though it is plainly obvious that most people think it is.

     

    Though it can, in many circumstances, improve performance, there are also circumstances under which it will provide little or no noticeable benefit. Not coincidentally, a new SSD tested fresh out of the factory packaging is unlikely to show much (if any) benefit. Or rather, TRIM is providing a real benefit for new SSDs, but that benefit doesn't become measurable in terms of benchmark performance testing until every memory cell in the SSD -- including many gigabytes of cells hidden from visibility by the SSD controller -- have been written to at least once. Writing 128 GB of files to an SSD with a nominal capacity of 128 GB won't do it, as there are several gigabytes (exact number varies depending on the model) still unwritten.

     

    Under real-world use conditions, having TRIM disabled means eventually having noticeable write performance degradation due to write amplification. It is far greater than "9%" -- it can be a 50% or greater drop in write performance, depending on various factors. Defining "eventually" is difficult because it depends on how the SSD is used. But given enough time and write cycles, it can happen to all SSDs used without TRIM, no matter how sophisticated their garbage collection algorithms are.

     

    Under those same real-world use conditions, having TRIM enabled means that the SSD should almost never reach a state of having noticeable write performance degradation, as it should almost never get into a state where write amplification is happening.

     

    I will concede that it is possible to design a lab test in such a way as to defeat the benefits provided by TRIM, but such tests do not reflect any real-world usage scenario I can imagine. Furthermore, those same contrived tests would put an un-TRIMmed drive into an equally-addled state even more quickly.

    I would suggest reading through the rather lengthy previous discussions about TRIM. Here are a couple of my past posts that are most relevant to the current discussion:

     

    A description of what TRIM is here.

    I addressed some of OWC Larry's comments about TRIM use with OWC/SandForce SSDs here.