locked
Defragging SSDs a default?

    Question

  • Curiously, despite my C drive (and System Reserved partition) being SSD, MS defaults to defragging both of them, on a weekly basis. The application log indicates that that indeed happened, which is how I noticed this in the first place.

    I ran defrag manually and deselected those two partitions, but is the applog right, were they really defragged (or optimized, whatever you want to call it)?  MS, even back in the W7 days, knew to tweak certain things certain ways for SSDs, so this comes as a surprise.

    Saturday, March 3, 2012 9:48 PM

Answers

  • Hello, In Windows 7 - we turned off defrag for SSDs as you mention in your entry; but in Windows 8, we have changed the defrag tool to do a general optimization tool that handles different kinds of storage, and in the case of SSD's it will send 'trim' hints for the entire volume;

    SSDs are storage devices made of flash memory; flash memory unlike hard disks are block erasable devices - they can be written to at a byte level but need to erased at a block level; Trim is a storage level hint that was introduced in the Windows 7 days to indicate that Windows is not using certain regions of the storage device; NTFS will send these trim hints when files are deleted or moved from those regions; SSDs consume these hints to perform a cleanup in the background called as 'reclaim' that helps them get ready for next writes. The SSD may choose to perform the optimization immediately, store the information for later optimization or throw away the hint completely and not use it for optimization since it does not have time to perform this optimization immediately.

    In Windows 8, when the Storage Optimizer (the new defrag tool) detects that the volume is mounted on an SSD - it sends a complete set of trim hints for the entire volume again - this is done at idle time and helps to allow for SSDs that were unable to cleanup earlier - a chance to react to these hints and cleanup and optimizer for the best performance. We do not do a traditional defrag  (moving files to optimizer there location for space and performance) on SSDs.

    Thank you for your question and I hope this clarifies the need to run the Storage Optimizer on a regular basis.

    Thursday, March 8, 2012 7:34 PM
  • Hello, the real time trim hints are still sent to the SSD when the file system (NTFS) removes of moves files, but we know that the SSD may not be able to react to the hint sent at that time as it maybe busy doing other things like writing, erasing storage; the storage optimizer ensures that these hints are sent at idle to enable the SSD time to be able to react to the hints.

    Thanks for trying Windows 8 and I hope this clarifies your question

    Thursday, March 8, 2012 7:43 PM

All replies

  • I saw the defrag schedule was enabled on my system too and I have an SSD installed.  If you look closer at the defrag utility though and run it, at least in my case, it only takes a few seconds and actually runs the TRIM command on the drive, not the spindle disk type of defrag routine.
    Saturday, March 3, 2012 9:58 PM
  • That's good to know, but the event log is very misleading by saying "The disk defragmenter successfully completed defragmentation on (C:)" in one event and then "The disk defragmenter successfully completed retrim on (C:)" in another.

    Weirdly, it even mentioned that it did a "retrim" on my spinning drive!

    BTW, is W8's TRIM function actually dependent upon Defrag now?  If so, that may not be such a great thing, since there's a massive amount of "disable defrag" information out there on SSD sites. What triggered it in W7?


    • Edited by rseiler Saturday, March 3, 2012 10:07 PM
    Saturday, March 3, 2012 10:05 PM
  • That is odd.  I didn't check in Event Viewer, just noticed it said it was running TRIM when I kicked off the defrag...was actually in there to disable it but then saw it recognized my drive as an SSD so figured I'd run it and see what happens.  I don't have any spindle drives in this system, just SSD.

    Saturday, March 3, 2012 10:07 PM
  • I don't like it. W7 is on the SSD so W7 can deal with it. There is no reason for W8 to go anywhere near it. I have turned it off for the SSD but it still says it is on in the first popup. Have to wait and see what happens.  
    Saturday, March 3, 2012 10:16 PM
  • I too immediately turned / disabled defrag.

    But it is an interesting point about trim.

    Saturday, March 3, 2012 11:13 PM
  • Might this thread get a little love from [MSFT], since this is a pretty important issue, I think?

    Either it's supposed to be enabled for SSD because this is how TRIM is handled in W8, as opposed to W7, or it's not supposed to be enabled and TRIM is still handled in other ways.

    Either "The disk defragmenter successfully completed defragmentation on (C:)" message in Event Viewer can be taken at face-value or it's wildly misleading.

    Tuesday, March 6, 2012 3:47 PM
  • I'll look into it for you, I'm not aware of any changes though.

    --Joseph [MSFT] http://blogs.technet.com/b/joscon/

    Tuesday, March 6, 2012 4:27 PM
  • Hello, In Windows 7 - we turned off defrag for SSDs as you mention in your entry; but in Windows 8, we have changed the defrag tool to do a general optimization tool that handles different kinds of storage, and in the case of SSD's it will send 'trim' hints for the entire volume;

    SSDs are storage devices made of flash memory; flash memory unlike hard disks are block erasable devices - they can be written to at a byte level but need to erased at a block level; Trim is a storage level hint that was introduced in the Windows 7 days to indicate that Windows is not using certain regions of the storage device; NTFS will send these trim hints when files are deleted or moved from those regions; SSDs consume these hints to perform a cleanup in the background called as 'reclaim' that helps them get ready for next writes. The SSD may choose to perform the optimization immediately, store the information for later optimization or throw away the hint completely and not use it for optimization since it does not have time to perform this optimization immediately.

    In Windows 8, when the Storage Optimizer (the new defrag tool) detects that the volume is mounted on an SSD - it sends a complete set of trim hints for the entire volume again - this is done at idle time and helps to allow for SSDs that were unable to cleanup earlier - a chance to react to these hints and cleanup and optimizer for the best performance. We do not do a traditional defrag  (moving files to optimizer there location for space and performance) on SSDs.

    Thank you for your question and I hope this clarifies the need to run the Storage Optimizer on a regular basis.

    Thursday, March 8, 2012 7:34 PM
  • Hello, the real time trim hints are still sent to the SSD when the file system (NTFS) removes of moves files, but we know that the SSD may not be able to react to the hint sent at that time as it maybe busy doing other things like writing, erasing storage; the storage optimizer ensures that these hints are sent at idle to enable the SSD time to be able to react to the hints.

    Thanks for trying Windows 8 and I hope this clarifies your question

    Thursday, March 8, 2012 7:43 PM
  • Yes, thank-you.
    Thursday, March 8, 2012 8:24 PM
  • Windows 8, we have changed the defrag tool to do a general optimization tool that handles different kinds of storage, and in the case of SSD's it will send 'trim' hints for the entire volume

    This is excellent news.

    I hope that RAID controller designers are working on updates or new products that properly propagate TRIM commands to individual drives.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Saturday, July 7, 2012 8:35 PM
  • Hello, thank you very much for this explanation!

    Is the real time Trim hints always enabled on Win8, when a SSD is detected? Is there a way to turn it on/off (by a property or command line)?

    Thanks!!

    Friday, August 17, 2012 6:14 PM
  • How about if it is a Sandforce controller that do not perform background (idle time) BC? I read the Sandforce manual that mentions it does not perform BC until it is necessary to write on a dirty block. They claim that this help to achieve a low write amplification. I read the article on such as anandtech.com and found that the intel ssd toolbox's optimization operation does not work on its 520 series ssd with a sandforce controller. But exactly, the drive gradually recover from a dirty status as the writing is performed.

    Saturday, August 18, 2012 1:43 AM
  • Hello, In Windows 7 - we turned off defrag for SSDs as you mention in your entry; but in Windows 8, we have changed the defrag tool to do a general optimization tool that handles different kinds of storage, and in the case of SSD's it will send 'trim' hints for the entire volume;

    SSDs are storage devices made of flash memory; flash memory unlike hard disks are block erasable devices - they can be written to at a byte level but need to erased at a block level; Trim is a storage level hint that was introduced in the Windows 7 days to indicate that Windows is not using certain regions of the storage device; NTFS will send these trim hints when files are deleted or moved from those regions; SSDs consume these hints to perform a cleanup in the background called as 'reclaim' that helps them get ready for next writes. The SSD may choose to perform the optimization immediately, store the information for later optimization or throw away the hint completely and not use it for optimization since it does not have time to perform this optimization immediately.

    In Windows 8, when the Storage Optimizer (the new defrag tool) detects that the volume is mounted on an SSD - it sends a complete set of trim hints for the entire volume again - this is done at idle time and helps to allow for SSDs that were unable to cleanup earlier - a chance to react to these hints and cleanup and optimizer for the best performance. We do not do a traditional defrag  (moving files to optimizer there location for space and performance) on SSDs.

    Thank you for your question and I hope this clarifies the need to run the Storage Optimizer on a regular basis.

    Thanks to this post I decided to re-enable the defrag tool, however because of your answer it made it seem like the tool will automatically recognize SSD's and only send the TRIM hint instead of an actual traditional defrag. This is NOT true until you at least do one initial WEI run. I just ran the defrag tool in my eval of Windows 8 and it took over 5 minutes with 9 or 10 optimization/consolidation passes. I then realized that Windows was treating my Vertex 2 SSD just like a spinning hard drive. Not very happy about that...

    To EVERYONE who finds this thread, please if you just installed Windows 8 fresh, make sure your system has run at least one WEI assessment as soon as you can, otherwise the default defrag setting is to optimize/defrag your SSD just like it does to a spinning drive. IMO, this should be documented somewhere or maybe noted on the face of the defrag tool window itself... 

    Tuesday, September 25, 2012 12:35 AM
  • Yes, you're exactly right - the WinSAT tool is the facility that makes the determination that the drive must be an SSD and switches the functionality (disabling defrag automatically in Win 7 and changing it to the new scheme in Win 8).

    Don't worry that it defragged your SSD.  That actually may be good in a way, since even though SSD latency is tiny it's still faster to access files sequentially rather than from a lot of disparate LBAs.  And now Windows 8's optimization will tell the SSD to go ahead and erase all those blocks that are dirty after the defrag.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Tuesday, September 25, 2012 4:48 PM
  • Yes, you're exactly right - the WinSAT tool is the facility that makes the determination that the drive must be an SSD and switches the functionality (disabling defrag automatically in Win 7 and changing it to the new scheme in Win 8).

    Don't worry that it defragged your SSD.  That actually may be good in a way, since even though SSD latency is tiny it's still faster to access files sequentially rather than from a lot of disparate LBAs.  And now Windows 8's optimization will tell the SSD to go ahead and erase all those blocks that are dirty after the defrag.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Oh, I am not to worried about it Noel, if I remember correctly I have that particular SSD over provisioned by about 30%. However, there are many that will undoubtedly get angry not knowing that the defrag tool will do a real defrag if the system has not identified it as an SSD yet. I still believe a small footnote should be in order on the face of the defrag tool telling people to run a WEI assessment first (as long as the defrag tool senses the assessment has never been run). The Vertex 2 may be fairly old tech already but it has been rarely used just sitting in a non-used Laptop until recently. So, having all that writing to it right away kinda upset me at first.

    Anyway, I was so against Windows 8's new metro look until about a week ago but all this new technology and speed might turn me around. I am a sucker for Desktop performance, startup performance and shutdown performance. Its just nice to ask your system to do something and it does it immediately without thinking about it. Thank you...

    -Rod 

    Monday, October 1, 2012 6:32 AM
  • You and I sound like birds of a feather, Rod.

    When you want to kick things up to the next level, consider building a RAID array of SSDs.  Over 1 gigabyte/second sustainable I/O throughput is heady stuff.  Especially with a multi-core machine, nothing delays you, no matter how much you are already running!

    But even with one SSD your system will scream.  If you ever want to show the difference between SSD and HDD in file system performance to someone, try this:

    • Open a Windows Explorer window and navigate to the root of drive C:
    • In the files pane, select all files and folders.
    • Right-click and choose Properties.
    • Time how long it takes to enumerate all the files.

     

    A good SSD-equipped system will count up the files at something like 20,000 to 30,000 files/second!  A hard disk may only be able to do a tenth of that or less.

      

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options


    • Edited by Noel Carboni Monday, October 1, 2012 4:20 PM formatting glitch
    Monday, October 1, 2012 4:19 PM
  • We do not do a traditional defrag  (moving files to optimizer there location for space and performance) on SSDs.

    Wrong. On Windows 8 Pro RTM, the Maintenance Task (accessible through the Action center) performs a full block defragmentation on SSDs too. I don't know if it's a bug or a stupid feature, but this falsifies your statement.

    If it's an intended feature, please let us know what benefits it brings.

    Friday, November 2, 2012 5:27 PM
  • Sho Shot, had you run the WEI evaluation before seeing it do that?  Normally Windows makes the determination whether it's got an SSD or not based on the result of that.

    Also, if you bring up the "Optimize Drives" panel, what does it show for the "Media type" for the drive in question on your system?  This is the panel I mean, accessible by searching on the Start screen for defrag and choosing Defragment and optimize your drives in Settings.

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Friday, November 2, 2012 6:22 PM
  • Yep, sure, on a fresh new "Windows 8 Pro with Media Center", after WEI etc. Running a manual optimization indeed correctly retrims SSD drives, and nothing more, as expected. Same behaviour when running "defrag /o" of a ssd at an elevated command prompt...

    However it's a different story when triggering manually the "Automatic Maintenance" from within the Action Center.

    It starts with a Quick Scan by Windows Defender, then moves on to defragment my good old hard disk drive, then continues with a complete defragmentation & consolidation (5 passes...) of my system SSD.

    See screenshots taken minutes ago:

    http://i47.tinypic.com/2j2b6hl.jpg

    http://i47.tinypic.com/ekri94.jpg

    As you can see, the Action center notification icon & window indicate "Maintenance" in progress ; in the defragmenter window, my correctly-detected SSD drive is undergoing its Xth pass of defragmentation then consolidation... So, bug or feature ? Would Microsoft engineers explain us how, contrary to popular belief, defragmentation makes sense for solid state drives? ;)



    edit: as a sidenote, this "Maintenance" is still in progress after 30 minutes, but it's impossible to have any idea about what it's doing exactly... So, what does this flawed "Automatic maintenance" hide???



    Saturday, November 3, 2012 2:56 AM
  • Wow, I don't think you could have better shown that there is a serious bug there than to catch it in the act!  That's disappointing to say the least.

    Defragging isn't particularly helpful and can potentially shorten the life of the drive, not to mention reduce performance (as its internal tables get all jumbled up). 

    An actual defrag maybe once a year might be worth doing, but no way should it happen on a schedule every Wednesday!

    For what it's worth, systems can in general do big contiguous I/O requests more efficiently than several small ones, which is why a VERY occasional actual SSD defrag could marginally speed things up.  That said, the IOPS (I/Os per second) capability of modern new SSD designs keeps going up, so that potential speed-up becomes less and less.

    I hope Kiran Bangalore sees your note!

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options


    Saturday, November 3, 2012 3:23 AM
  • I had a thought...

    What if it's emitting status messages that look like a real defrag but is really sending it's TRIM hints?

    Microsoft COULDN'T have been so lazy as not to change the status messages, could they?

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Saturday, November 3, 2012 3:29 AM
  • As for the benefits of true defragmentation on solid state drives, I've always read the opposite - which makes sense given the inner workings of SSDs...

    Should I mention that on my system the prefetch function is [b]enabled[/b] despite a 7.7 scoring by WEI for my drives?

    Looks like MS broke what used to work perfectly fine in Win7... ;)


    Saturday, November 3, 2012 3:33 AM
  • I had a thought...

    What if it's emitting status messages that look like a real defrag but is really sending it's TRIM hints?

    Microsoft COULDN'T have been so lazy as not to change the status messages, could they?

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options


    The drive had been trimmed already (manually) about 50 minutes before triggering the automatic maintenance.
    Saturday, November 3, 2012 3:47 AM
  • As for the benefits of true defragmentation on solid state drives, I've always read the opposite - which makes sense given the inner workings of SSDs...

    As with most things the issue defies being oversimplified.

    Yes, there's no use whatsoever inside the SSD for "defragging".

    However, for the computer itself, accessing the file system... 

    Imagine that the operating system has to issue just one request to read a large chunk of data.  This could be one big file it needs to read to do something it does all the time.  Or maybe the swap file.

    Here's the kicker:  If that same file is broken up into non-contiguous logical blocks at the file system level, the operating system has to follow the chain in the file system and issue bunches of small read requests instead of one big one.

    At the extremes, some modern SSDs can transfer 500+ megabytes/second with single large contiguous operations, but only as little as 20 megabytes/second if the data is broken up into 4K chunks.  That's just the overhead adding up from having to issue a bunch of small commands, wait for responses, issue more commands, wait for more responses.

    It's really the same concept as with a spinning hard drive.  It's just that the extra overhead isn't very large since there's no rotational delay or seek time - but the overhead isn't truly zero.

    You just don't really want to defrag an SSD very often at all, because there are downsides.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options



    Saturday, November 3, 2012 3:57 AM
  • As for the benefits of true defragmentation on solid state drives, I've always read the opposite - which makes sense given the inner workings of SSDs...

    As with most things the issue defies being oversimplified.

    Yes, there's no use whatsoever inside the SSD for "defragging".

    However, for the computer itself, accessing the file system... 

    Imagine that the operating system has to issue just one request to read a large chunk of data.  This could be one big file it needs to read to do something it does all the time.  Or maybe the swap file.

    Here's the kicker:  If that same file is broken up into non-contiguous logical blocks at the file system level, the operating system has to follow the chain in the file system and issue bunches of small read requests instead of one big one.

    At the extremes, some modern SSDs can transfer 500+ megabytes/second with single large contiguous operations, but only as little as 20 megabytes/second if the data is broken up into 4K chunks.  That's just the overhead adding up from having to issue a bunch of small commands, wait for responses, issue more commands, wait for more responses.

    It's really the same concept as with a spinning hard drive.  It's just that the extra overhead isn't very large since there's no rotational delay or seek time - but the overhead isn't truly zero.

    You just don't really want to defrag an SSD very often at all, because there are downsides.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options




    Do you mean it might be an intended feature rather than some overlooked bug?
    Saturday, November 3, 2012 9:13 PM
  • No, it looks like a bug to me, because I don't see any way to specify "defrag" vs. "TRIM optimize".  Plus some folks report that it seems to do what Kiran said it should without having to do anything special.  I've heard back from at least one person over on the OCZ forum that they've seen it work right.

    Now, since there could be utility in it as I have shown, maybe it SHOULD be possible to actually defrag your SSD if you should want to do it, say once a year or so.  Making it either-or seems an oversimplification.

    That Microsoft doesn't see the utility in keeping the defrag and TRIM optimization functions separate, and has instead (if you read what Kiran wrote above) intended to completely switch off the ability to defrag an SSD entirely (bugs notwithstanding) seems to say that they don't really understand the technology, which I find kind of strange.

    What brand/model SSD do you have?  Just curious.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Sunday, November 4, 2012 2:53 AM
  • Samsung 830 from early 2012, 64 GB.

    For tech-savvy power users who see a benefit to defragmenting their SSD, it is already possible with defrag /D <ssd drive>. IMHO Microsoft should have implemented a hardcoded safeguard when it comes to defragmentation of identified SSD devices, making for instance the operation impossible without both 1/ user information and 2/ user confirmation.

    OTOH if I understand well how wear-leveling algos truly work, defragmenting a SSD will hardly ever improve access time - all a traditional defragmentation would achieve on these devices is to cause a change in the random physical distribution of data - that is, giving ~randomly-distributed clusters another random distribution, causing in the meantime a significant number of read-write cycles (hence wearing down cells). As a result, depending on the device specs and built-in logics of read access through multiple channels, the new distribution could prove either slower or faster than before... only due to ~chance. There is no such thing as "contiguous operation".


    Sunday, November 4, 2012 5:55 AM
  • You have it right, except for the concept that from the computer the data can be requested or written in small or large chunks depending on whether the data is stored in sequential logical blocks (and even though that's abstracted to potentially random addresses inside the SSD).  The larger the I/O requests, from the system's perspective, the fewer requests are needed, and thus the lower the overhead at that level.  Like I said that can still make a 10x difference in overall throughput - just not 100x or more as with a spinning HDD.  Just look at any "Sequential" benchmark numbers for your SSD vs. "4K" results to see that difference.

    And yes, it would wear down the SSD to read and write a lot of blocks, though you don't have to worry about that as much as you used to.  Modern wear-leveling SSDs, especially large ones, will likely outlast the computers they're in several times over even with heavy write loads.  But that's why I like to RAID them - that spreads the wear even thinner.

    Ideally this "SATA mass storage device" abstraction will be superseded entirely and the flash storage will move into the processors' address space for direct access in future systems.  I'm not sure exactly how that's going to look, but inexpensive and gargantuan mass storage with nearly instantaneous random access will yield new breakthroughs we haven't thought of yet - maybe even the holy grail of actual computer intelligence - machines we can converse with on OUR terms.  SSD drives are just a stepping stone.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options


    • Edited by Noel Carboni Sunday, November 4, 2012 2:43 PM typos
    Sunday, November 4, 2012 1:40 PM
  • Curious as to how defragmentation of the logical cluster address space (i.e. filesystem-level) would impact the access times by so much (10x slower, really? then it makes sense to defragment filesystems sitting on a SSD).

    (IIRC benchmarking results show rather a 0.5 factor in final throughput between single large sequential and multiple simultaneous randomly-spread 4k accesses. Not so big an impact for a 10x slower access time... OK, that's nitpicking and on the verge of off-topicness)



    Sunday, November 4, 2012 3:48 PM
  • For me it only optimizes the disk (sending TRIM) and NOT doing a full consolidation:

    Have you run WinSAT? What is your score? Do you use the latest AHCI drivers for your chipset?


    "A programmer is just a tool which converts caffeine into code"

    Sunday, November 4, 2012 4:14 PM
    Answerer
  • (IIRC benchmarking results show rather a 0.5 factor in final throughput between single large sequential and multiple simultaneous randomly-spread 4k accesses. Not so big an impact for a 10x slower access time... OK, that's nitpicking and on the verge of off-topicness)

    That's true, as multiple requests can be outstanding at once in a multitasking system, but few applications actually do multiple simultaneous requests to read data from one file.  So what you feel is a slowdown.

    Your performance DOES go down with a logically fragmented file system, but since there's always been such a downside to subjecting SSDs to extra write activity the general advice is to avoid doing a lot of defragging.  That has translated to "do none" in this black and white world of oversimplfied rules of thumb, but it's not necessarily the best advice. 

    And thanks, by the way,  for pointing out the /d switch.  I hadn't thought about the command line before (that's embarrassing - guess I'm losing my geek edge)...  Check the command line for the ScheduledDefrag job in the Task Manager.  Have you tried to force it there to do a /L (Perform retrim on the specified volumes)?

    It's entirely possible you'd never see a downside to just letting Windows 8 do it's thing as it is.  Or you might.  Out of the box it really should work properly, as designed, consistently.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    • Proposed as answer by ST-TPS Sunday, December 9, 2012 6:54 PM
    Sunday, November 4, 2012 5:32 PM
  • For me it only optimizes the disk (sending TRIM) and NOT doing a full consolidation:

    Have you run WinSAT? What is your score? Do you use the latest AHCI drivers for your chipset?


    "A programmer is just a tool which converts caffeine into code"

    Was the screenshot taken during the "Automatic Maintenance" task?

    I ran the WinSAT experience index just after initial setup. My drive subsystem shows a consistent 7.7 score (Samsung 830 64GB SSD and WD Scorpio Blue 1TB, with latest Intel RST 11.6 driver). Nevertheless, prefetch/superfetch was not disabled (had to disabe the service manually and purge the prefetch folder), and now the automatic maintenance insists on defragmenting (not retrimming) the SSD...

    Monday, November 5, 2012 3:32 PM
  • I've clicked on the "optimize" button to show it only runs TRIM (takes 5s), so no full consolidation with several passes. But it may be an Intel driver issue. I have the 256GB Samsung 830 SSD and I'm using the AMD AHCI driver. Have you tried the StorAHCI drivers which come with Windows 8?

    "A programmer is just a tool which converts caffeine into code"

    Monday, November 5, 2012 3:36 PM
    Answerer
  • (IIRC benchmarking results show rather a 0.5 factor in final throughput between single large sequential and multiple simultaneous randomly-spread 4k accesses. Not so big an impact for a 10x slower access time... OK, that's nitpicking and on the verge of off-topicness)

    That's true, as multiple requests can be outstanding at once in a multitasking system, but few applications actually do multiple simultaneous requests to read data from one file.  So what you feel is a slowdown.

    Your performance DOES go down with a logically fragmented file system, but since there's always been such a downside to subjecting SSDs to extra write activity the general advice is to avoid doing a lot of defragging.  That has translated to "do none" in this black and white world of oversimplfied rules of thumb, but it's not necessarily the best advice. 

    And thanks, by the way,  for pointing out the /d switch.  I hadn't thought about the command line before (that's embarrassing - guess I'm losing my geek edge)...  Check the command line for the ScheduledDefrag job in the Task Manager.  Have you tried to force it there to do a /L (Perform retrim on the specified volumes)?

    It's entirely possible you'd never see a downside to just letting Windows 8 do it's thing as it is.  Or you might.  Out of the box it really should work properly, as designed, consistently.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    The Defrag scheduled task shows a sensible "defrag -c -h -o" command line (i.e. optimal defrag method for each drive).

    As stated previously, it's only the Automatic Maintenance task (found in the Action center) that shows the unexpected behaviour. I can not find where this task stores its various actions and settings... The fact that neither defragmentation nor prefetching was disabled for my SSD suggests the issue lies lower in the chain ; perhaps does WinSat fail at enforcing its settings somewhere, or...

    Monday, November 5, 2012 3:36 PM
  • Automatic Maintenance uses the ScheduledDefrag task in the Task Scheduler.  To verify this, open the Task Scheduler and look to see that the task Status changes to Running when you've requested Automatic Maintenance via the Action Center (you'll need to refresh Task Scheduler with F5 if you start the task after Task Scheduler has been opened).

    That says the -o switch isn't making the right thing happen in your case.

    On another forum where I mentioned this I've had users report that the right things are happening with their SSD-equipped Windows 8 systems, so at best this is an intermittent problem.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options


    Monday, November 5, 2012 3:54 PM
  • I would like to add that I have also observed this behaviour.

    The defrag tool itself behaves correctly and only TRIMs my SSD.

    However, after starting Maintenance manually, I noticed my SSD was being hammered by continuous activity from the defragger.

    This is clearly incorrect behaviour.


    Edit: I have taken a screenshot of the defrag occurring: http://sdrv.ms/SxQaQe
    • Edited by mattsharpe Tuesday, November 6, 2012 5:23 PM Added screenshot
    Tuesday, November 6, 2012 5:08 PM
  • Hi,

    Having read the above discussion, to be on the safe side I have disabled my scheduled disk-defragmentation and system-maintenance tasks.

    To disable scheduled defragmentation, click Control Panel > Administrative Tools > Task Scheduler. Open Task Scheduler Library > Microsoft > Windows > Defrag. In the middle pane, right-click ScheduledDefrag and click Disable.

    To disable scheduled maintenance, click Control Panel > Administrative Tools > Task Scheduler. Open Task Scheduler Library > Microsoft > Windows > Maintenance. In the middle pane, right-click WinSAT and click Disable.

    This way your system will not send trim hints to your SSD(s) but will also not defragment them unnecessarily. You can optimize your SSD(s) using the dedicated software from their manufacturer(s). For Intel SSDs use the Intel SSD Toolbox.

    Hope this helps.



    • Edited by groucho43 Friday, November 9, 2012 9:53 PM
    Friday, November 9, 2012 9:47 PM
  • Hi,

    <snip>

    To disable scheduled maintenance, click Control Panel > Administrative Tools > Task Scheduler. Open Task Scheduler Library > Microsoft > Windows > Maintenance. In the middle pane, right-click WinSAT and click Disable.


    I think it's not the right task (especially given the nature of WinSAT...) :)

    Judging by its execution time (3:00 AM daily on my system) and name, the task to disable to avoir Automatic Maintenance and its side effects should be:
    Task Scheduler > Task Scheduler Library > Microsoft > Windows > TaskScheduler > Regular Maintenance

    As for the Scheduled Defrag, I'm running the task manually right now to check whether it triggers the same bug with SSDs or not...

    --- edit:

    Indeed the "Scheduled Defrag" task runs with the following parameters : "defrag.exe -c -h -o -$" (= defragment all drives, with high priority, using appropriate method, with some unknown "$" option). Running this task manually causes a full defrag+consolidation of SSD drive (can be reproduced at the elevated command prompt: defrag <ssd drive> -h -o -$)

    Editing the Scheduled Defrag task to remove the "-$" seems to fix the issue. Now I'll check if the same is true when itself triggered by the Automatic Maintenance task.

    --- edit 2:

    Ran the Automatic Maintenance (which itself calls the Defrag), and the SSD drive is correctly trimmed not defragg'd :)


    • Edited by HotShot ಠ__ಠ Saturday, November 10, 2012 4:54 PM
    • Proposed as answer by ST-TPS Sunday, December 9, 2012 6:53 PM
    Saturday, November 10, 2012 1:25 PM
  • That's interesting info.

    How did you determine that the drive was correctly trimmed and not defragged?  

    When I change the switches or make ANY changes to the command line in the Task Scheduler, then any attempt to make changes to the disk maintenance settings through the GUI nets me this message:

    If I choose [ Keep customized settings ] I end up with the -$ switch again, but then I get to the Optimize Drives screen to where I can see what's happening.  The other button is essentially [ Cancel ] and I get no further.

        

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Saturday, November 10, 2012 5:20 PM
  • By the way I verified, as you did, that the defrag command on the command line invokes actual defragmentation when -$ is selected.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Saturday, November 10, 2012 5:26 PM
  • That's interesting info.

    <snip>

    If I choose [ Keep customized settings ] I end up with the -$ switch again, but then I get to the Optimize Drives screen to where I can see what's happening.  The other button is essentially [ Cancel ] and I get no further.

        

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Same observation here. Keeping "customized" ("corrected" settings) prevent the GUI from appearing.

    Well, I can live without the Defrag GUI, if everything scheduled works as expected...

    Saturday, November 10, 2012 5:35 PM
  • I guess if you needed to make a substantive change (e.g., because of the addition of a drive or something) you can always try to remember to carve off the -$ switch again.

    Interesting that some folks are reporting it works right out of the box with their SSDs.  I guess the challenge remains to try to figure out what the -$ switch actually is supposed to mean.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Saturday, November 10, 2012 6:58 PM
  • Sorry for the lack of follow-up, was busy reinstalling (again... ten times in a week... it's by forgering you become a smith, they say).

    As for your previous question, I launched the Defrag GUI *before* editing the Scheduled Defrag task, only to be able to see what was happening while tasks were running. Indeed a later launch of the GUI brought the "Do you want to restore optimization settings" dialog box.

    Pending further resolution by Microsoft, a temporary workaround: through the Defrag GUI, allow scheduled defrag but edit its settings so as to exclude the SSD drive(s). With the scheduled task edited this way, automatic maintenance does not attempt to defrag SSD drives at all, only the regular hard disks which are left checked. Of course one has to live with the lack of a scheduled automatic retrim... Not so worrying IMHO.

    (If really troublesome, one could definitely create a new scheduled task to launch "defrag -o" on these SSD drives only!)

    • Proposed as answer by ST-TPS Sunday, December 9, 2012 6:53 PM
    Sunday, November 11, 2012 11:51 PM
  • That sounds like a reasonable answer to this whole thing:  Disable the scheduled defrag of all SSDs, then add one's own entry to the Task Scheduler.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Monday, November 12, 2012 12:20 AM
  • I'm building a system this week with a solid state and windows 8.  I'm currently running 8 on a laptop with a mechanical hdd so this hasn't been an issue.  I found this thread while searching for info on win 8 and ssd.

    Anyway I read the thread twice and still have a couple questions.  I think the last two post answer them but I want to be sure that I have this straight ;)

    So if I turn off scheduled defrag either for ssd or all drives (I use defraggler for my mechanical hdds) then the automatic maintenance will not defrag the ssd when it launchs in the background?  And as such will not send trim either?

    I assume I can then run the "defrag/optimizer" from the gui manually and it will only do trim?  If that is the case how often should I run the trim manually?  I have a corsair ssd and there is no manufacturer ssd tool for them. 

    Gordon

    • Edited by gordonlw Thursday, November 15, 2012 4:44 PM
    Thursday, November 15, 2012 4:41 PM
  • Honestly, you should normally not need to re-TRIM your drives, but if at any time a drive were to ignore a TRIM hint (possibly because it was heavily loaded with disk activity) it might not internally erase the flash blocks associated with the logical disk blocks that were part of a deleted file.  This doesn't really hurt anything, it just makes it a tiny bit slower to write to those blocks next time.  I don't know the specifics of your particular drives, so I can't say whether that's even possible.

    I don't know if I'd trust the GUI interface at all, though.  I don't think it's working right because of the presence of that -$ switch.

    If you strictly want to run it manually, instead I'd suggest running the following command from an elevated CMD prompt, as the /O switch in absence of the -$ switch seems to choose to re-TRIM correctly.  Note that you'll want to substitute your actual SSD drive letter for x.

    defrag  x:  /O

    At the command line run defrag -? to see all the options available.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options



    • Edited by Noel Carboni Thursday, November 15, 2012 5:52 PM typo
    • Proposed as answer by ST-TPS Sunday, December 9, 2012 6:53 PM
    Thursday, November 15, 2012 5:50 PM
  • thanks!  so again if scheduled defrag is off the automatic maintenance (in the background on idle) will not attempt defrag?  one more thing does win 8 auto trim like win 7 or is it just done via the defrag now?
    Thursday, November 15, 2012 6:07 PM
  • Windows 8 sends TRIM hints to drives, assuming your storage controller driver handles them properly, whenever you do normal file operations.

    Only you can decide whether you just want to disable the scheduled drive optimization entirely or just for your SSD volumes (assuming you have both SSD and HDD storage).  I'd suggest leaving as much of it enabled as possible.  It might work just fine on your system just as it comes configured from the factory - some folks (elsewhere on an SSD forum I frequent) have said the scheduled optimization and when it is run manually from the Action Center all just re-TRIM their drives.

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Thursday, November 15, 2012 6:31 PM
  • thanks for the help!  I plan to set everything up normally and then try to see what happens when maintenance is triggered like in sqfp's screenshot.  just wanted to make sure what to do in case it does try a full defragmentation.
    • Edited by gordonlw Thursday, November 15, 2012 6:54 PM
    Thursday, November 15, 2012 6:54 PM
  • I observed the same behaviour on my system (Windows 8 Pro 64-bit installed on SSD) and adjusted the scheduled defrag Tasks accordingly. Thanks!

    Sunday, December 9, 2012 6:56 PM
  • If you strictly want to run it manually, instead I'd suggest running the following command from an elevated CMD prompt, as the /O switch in absence of the -$ switch seems to choose to re-TRIM correctly.  Note that you'll want to substitute your actual SSD drive letter for x.

    defrag  x:  /O

    At the command line run defrag -? to see all the options available.

    Although /L (Perform retrim on the specified volumes) might be more to the point, right?  Doesn't using /O leave open the door that the "proper" optimization is not actually run, say, because someone hasn't run WinSAT yet or because of Defrag's general confusion?
    Sunday, December 9, 2012 8:07 PM
  • I was running on the assumption that Microsoft may have implemented something more complex than a simple A/B switch between defrag and retrim for HDD vs. SSD, AND that they'd make the determination of which kind of drive is installed properly. 

    But of course that may not be valid. 

    You're right - /L would certainly put you in control, and you could choose to run a true defrag with the /D switch just when you want (if at all).

     

    -Noel


    Detailed how-to in my eBooks:  

    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

    Sunday, December 9, 2012 8:50 PM
  • Can we get this thread un-marked as answered? It is most certainly not answered.
    Tuesday, January 8, 2013 9:01 PM