Wednesday, 29 December 2010

Never Defragment an SSD

Filed under: Hardware & Gadgets — Jan Goyvaerts @ 10:16

When a traditional hard disk with spinning platters and moving heads needs to read a (very large) file, it can do so much faster if the file is stored in an unbroken sequence of blocks on the drive. If different pieces of the file are spread around the drive, the hard disk’s heads need to physically move between those pieces. The time it takes is indicated as the seek time in drive specifications.

Defragmentation software rearranges all the files on the drive so they are all stored in unbroken sequences. In Windows you can find it under Start, All Programs, Accessories, System Tools, Disk Defragmenter. Defragmenting mechanical hard disks is a good idea. It’ll noticably speed up your PC if your system drive is a heavily fragmented hard disk. Hard disks are the slowest component in modern PCs. They can use all the help they can get. (That’s also the reason why it makes a lot of sense to replace your system drive with an SSD.) Because defragmentation is so helpful, Windows actually does it automatically when your PC is idle. You may have noticed the HDD drive light on your PC flickering furiously when coming back from lunch, only to stop instantly as you touch the mouse.

Defragmenting an SSD is a terrible idea, for several reasons:

The key benefit to SSDs is that they have virtually no seek time. Reading adjacent blocks of data is no faster than reading blocks that are spread out over the drive. Fragmentation does not affect SSD drive speed.

As I discussed in my SSD Remaining Drive Life article, SSD drives physically wear out as you write to them. Defragmentation software moves around all the files on your drive. Thus, defragmenting an SSD reduces its life span without giving you any benefits.

SSD drives deal with the limited lifespan of their memory cells by using wear-leveling algorithms. These algorithms take advantage of the fact that fragmentation does not affect the drive’s speed. They purposely fragment the drive so that its cells wear out evenly, even if you’re constantly overwriting a small set of files (e.g. database fiels) and never overwriting other files (e.g. operating system files).

Modern SSDs even lie to the operating system. If the operating system tells the drive to save a file in blocks 728, 729, and 730, the drive may decide to write it to blocks 17, 7829, and 78918 instead, if it determines that those blocks haven’t been worn out as much yet. The drive keeps a lookup table of all its blocks, so that when the OS wants to read blocks 728 through 730, the drive reads blocks 17, 7829, and 78918. With such drives, defragmentation software can’t possibly work. The software will think and tell the user that file X was nicely defragmented and stored in blocks 728, 729, and 730, while it actually has no idea where the data is stored physically on the drive.

Conclusion: don’t waste your time and your SSD’s life expectancy by defragmenting it. The automatic defragmentation in Windows 7 skips SSDs automatically. In Vista, you can disable it via the Performance Information and Tools item in the Control Panel. I do strongly recommend you upgrade to Windows 7 if you have an SSD, so you get TRIM support.


  1. Another thing I remember hearing: You should never fill your SSD with data – try to leave some free space. This gives more room for the internal wear-levelling to work, increasing the life span.

    Comment by Dan — Wednesday, 29 December 2010 @ 16:08

  2. To save your SSD, don’t put a swapfile on it!

    Once you have installed all your software, it is OK to defrag the drive ONCE, just to simplify the arrangement of directories and files. MyDefrag has a good option to do this. Then leave the darn thing alone!
    Steve Gibson of GRC.com and the maker of SpinRite, has similar views in the Security Now podcast #282.

    Comment by Donn Edwards — Saturday, 8 January 2011 @ 1:33

  3. I have mentioned your article in my “Before You Defragment you PC” article at

    Comment by Donn Edwards — Saturday, 8 January 2011 @ 2:33

  4. Hi,

    I have to draw back my previous comment,it was not correct
    Defragmentation of a SSD is strongly not recommended.
    SSDs are not comparable with HDDs as they are using a different
    read/write technology.
    So there is no defragmentation for SSDs, the only way to opimize
    SSDs is to use the TRIM command, so that previous used memory blocks are
    released again.
    There is an issue with the life span of SSDs, write circles should be
    not too much, SSD wear out with the number of write cycles.

    Comment by Andy — Friday, 15 July 2011 @ 19:45

  5. “2. To save your SSD, don’t put a swapfile on it!”

    Really? So in notebooks/netbooks which include only one drive and derives the greatest benefit from SSD, are you proposing not having a swapfile at all? You know how I get the best performance out of my XP box without any headaches – I use an SSD for the swapfile. Hey wait, let’s try this one on for size – why would Microsoft create ReadyBoost for using flash media for additional memory if it’s got such a limited life?

    The major manufacturers indicate that with normal day to day drive use, you’ll get about 27 years out of the average SSD – which is likely 5 to 10 times the amount most people will even keep a machine. You say “oh, but I can put the SSD in my next machine”. However, by the time you’re ready for your next machine, the SSDs will have tripled in capacity, gone down in price, have greater performance, better technology, and an even longer expected lifespan.

    I think that many people who think they are technically knowledgable, even if they do have lots of real world technical experience over many years, are simply stating what they think, and regurgitating what others have said, and for the most part, it’s not true.

    Comment by Howard — Wednesday, 28 March 2012 @ 16:50

  6. BTW, with independent multi-heads “spinning platter” disks with fat caches (almost any modern high capacity hard disk) the story is a little more complicated than that. Instead of defrag’ing, one better uses a file system (‘formatting’) such as NTFS (standard on C: since Windows XP?) that automatically maintains a level of fragmentation that’s optimal for the characteristics of the disk. (And it does this ideally on-line, not in bursts during idle time. Not everyone leaves their computer on long enough all the time, after all.)
    With logging file systems such as ext4 on Linux, the physical mapping of the file system is basically a hierarchical structure of contiguous blocks containing a log logging file operations. Files, and their attributes and OS representation, are only logical entities reconstructed from the log.

    …all modulo bad block remapping as on SSD…

    Comment by Guy Bormann — Tuesday, 5 February 2013 @ 18:43

Sorry, the comment form is closed at this time.