SSD defragmentaiton thoughts

Discussion in 'backup, imaging & disk mgmt' started by Isso, Jun 20, 2012.

Thread Status:
Not open for further replies.
  1. Isso

    Isso Developer

    Joined:
    Mar 28, 2009
    Posts:
    1,450
    I noticed in two recent threads here at Wilders where people argue about SSD defragmentation. Let me share my thoughts as an engineer working in a company that produces SSDs.

    I believe that in most cases defragmenting SSDs won't result in noticeable performance improvement. Rather it will just cause excessive Flash memory wear. But too fragmented file system still may result in SSD performance degradation.

    Consider a file that has many fragments spread around the volume. Although there is no way to figure out how those fragments are physically positioned in SSD flash cells, still there are chances that they will be spread within SSD flash memory too; thus writing operation may require erasing more SSD blocks compared to a contiguous file, resulting in slower write speed.

    Free space fragmentation makes the file system fill the gaps by splitting the files into fragments, resulting in file fragmentation, and later in the situation described above.

    The smart caching mechanisms built into modern SSDs make this problem almost unnoticeable. Still after defragmentation of a heavily fragmented SSD the performance may somewhat increase. But there is one important issue to consider - the extremely high number of disk writes that defragmentation causes, decreasing the lifetime of SSD.

    Although the lifetime of modern SSDs is very long (thanks to smart wear leveling) and most likely even hourly defragmentaiton won't result in drive failure, still SSD owner should decide whether he needs somewhat better performance at the expense of decreased lifetime.

    Important note: if the OS (or the SSD) don't support TRIM then defragmentation will most likely only make the things worse.

    Finally I'd like to mention that there is a way to defragment the SSD using very few write operations (thousands of times less that normal). And our team is working on such product that will complement our SSDs. Unfortunately at this moment I can't disclose more information, just stay tuned :)
     
  2. TheRollbackFrog

    TheRollbackFrog Registered Member

    Joined:
    Mar 1, 2011
    Posts:
    3,050
    Location:
    The Pond - USA
    I would like to add a side note to this. When Isso mentions non-support by the OS above... it's not just the OS that's involved. It's also the drivers made available for use by the OS for certain SATA interfaces.

    I discovered the hard way that most SATA drivers for nVidia mainboard chipsets DO NOT support TRIM. The OS may supply the TRIM directive but the driver does not pass that command to the device, making the function inoperative.

    I don't know how many chipsets have this problem but I'm sure most of the nVidia mainboard chipsets do (there are discussions on te NET concerning these anomalies).
     
  3. Keatah

    Keatah Registered Member

    Joined:
    Jan 13, 2011
    Posts:
    853
    It's good to see continued development. Perhaps one day soon enough we'll see products ready for consumer usage that don't require tedious technical maintenance.
     
  4. Isso

    Isso Developer

    Joined:
    Mar 28, 2009
    Posts:
    1,450
    I agree, and I've heard before that some NVidia chipsets have special handling of SATA drives.

    I just re-read my original post and I guess it's somewhat unclear.

    My conclusion on defragmenting SSD is following:

    1. Defragmenting highly fragmented SSD may result in some performance improvement. However most of the consumer drives don't reach such level of fragmentation.
    2. Defragmenting causes large amount of write operations that decrease the lifetime of SSD, however modern drives have more than enough durability to cope with it.
    3. If TRIM isn't supported it's better to never use defragmentation
     
  5. Keatah

    Keatah Registered Member

    Joined:
    Jan 13, 2011
    Posts:
    853
    If TRIM isn't supported and it's not a good idea to defragment, then you're left with reformatting when the slowdowns occur.
     
  6. Isso

    Isso Developer

    Joined:
    Mar 28, 2009
    Posts:
    1,450
    Reformatting will help only if you do a full format with a flag that fills all sectors with zeros, and provided the drive has built-in garbage collection.

    Otherwise the only way to completely restore the factory performance is sending ATA SECURITY ERASE command. That will erase entire drive contents though. It can be done using hdparm utility and a bootable disc.
     
  7. Keatah

    Keatah Registered Member

    Joined:
    Jan 13, 2011
    Posts:
    853
    Whoaa!! Way too much stuff for the layperson to deal with.
     
  8. Isso

    Isso Developer

    Joined:
    Mar 28, 2009
    Posts:
    1,450
    I agree. But considering that vast majority of modern SSDs support TRIM, there is normally no need to do it.
     
  9. xxJackxx

    xxJackxx Registered Member

    Joined:
    Oct 23, 2008
    Posts:
    4,050
    Location:
    USA
    I do not believe that running a rare defrag will kill a SSD, however I don't think it will benefit one either. Read speed should not be affected, and the loss of write speed due to erasing more blocks (some of the blocks, it is not going to be a none vs. all situation) I really doubt anyone would notice the difference unless they are running a benchmark program and it shows them a chart with different numbers.

    I'm sure any advances in SSD technology that prevented that fragmentation to begin with would be greatly appreciated by all, but any fragmentation on a SSD drive is not going to make a noticeable difference to the average user. Anyone that is bothered by it will RAID 0 two or more of them anyway.
     
  10. Victek

    Victek Registered Member

    Joined:
    Nov 30, 2007
    Posts:
    5,123
    Location:
    USA
    I also have an Nvidia main board. Did you find a solution for the TRIM issue? Are there third party pci-E controllers for SSDs?
     
  11. Victek

    Victek Registered Member

    Joined:
    Nov 30, 2007
    Posts:
    5,123
    Location:
    USA
    Raxco PerfectDisk is addressing the SSD defrag issue:

    http://blog.raxco.com/2011/11/16/how-to-optimize-your-ssd-without-wearing-out-its-lifespan/

    I'm not fully up to speed on the tech and don't know for certain if this represents a real solution. Also, PerfectDisk has what it calls "Opti-write" which is supposed to minimize fragmentation during write operations.
     
  12. Keatah

    Keatah Registered Member

    Joined:
    Jan 13, 2011
    Posts:
    853
    People are seemingly still not understanding what a block map is, and that memory can only be erased in 512KB (typically) chunks, and that 1 512KB block may contain pieces of many different files.
     
  13. TheRollbackFrog

    TheRollbackFrog Registered Member

    Joined:
    Mar 1, 2011
    Posts:
    3,050
    Location:
    The Pond - USA
    Greetings! Yup, I picked up a PCIe-based 2-port SATA II (or III, I forget) controller (Marvel chipset-based) and it works just fine, as expected.

    I'm away from the system at the moment but will be happy to pass on the model # as soon as I return. There are many available... just make sure they don't use nVidia. Most are Marvel-based.
     
  14. DVD+R

    DVD+R Registered Member

    Joined:
    Aug 2, 2006
    Posts:
    1,979
    Location:
    The Antipodes
    :rolleyes: Right! lest settle this once and for all shall we, and disperse with ~ Snipped as per TOS ~ rumours that you can still defrag an SSD YOU CAN'T Or rather if you do then on your head be it, the simple fact is SSD drives dont fragment, "End of Topic" :shifty:
     
    Last edited by a moderator: Jul 10, 2012
Loading...
Thread Status:
Not open for further replies.