1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Impact of defrag command on SSD?

Discussion in 'Legacy Windows' started by andrea23, 2014/08/20.

  1. 2014/08/20
    andrea23

    andrea23 Inactive Thread Starter

    Joined:
    2014/08/20
    Messages:
    21
    Likes Received:
    0
    Hello everybody. Hope you can help me with this, please.

    I have a laptop running Windows 8.1 preinstalled and further equipped with a SSD (Samsung 250GB 840 EVO). Windows 8.1. has detected the SSD, which is scheduled to be optimised on a weekly basis. To make sure that TRIM was enabled, I run fsutil behaviour query disabledeletenotify and the result was '0'. By accident, I also run defrag C: on cmd and the command prompt window disappeared instantly. I immediately checked out the Defrag history on Event Viewer and noticed that there were two entries registered at exactly the same time (14:49:41secs): (1) the storage optimizer successfully completed "defragmentation" on Recovery; and (2) the storage optimizer successfully completed "retrim" on Recovery (please see details below). I had a look at the rest of the log entries which showed that the Recovery partition had been (apparently) "defragged" only on that occasion (when I run defrag by mistake). Both the C: drive and the Recovery partition had been successfully retrim on the other occasions.

    I just want to make sure that my SSD has not been defragmented, so I would be grateful if you could give me your views and/or answer these questions for me, please, since I am really concerned about it:

    - Is it possible that the defrag command was registered on Event Viewer (because it had been invoked on command prompt) but a "real" defragmentation did not actually occur since Windows 8.1. detected the SSD and automatically performed "retrim" rather than defrag? That could explain the existence of two entries registered at the same time.

    - Does Windows 8.1 prevents a SSD from being defragged through cmd even in the event of running the defrag command by mistake?

    I have done some research online but I could not find anything specifically related to my problem and the Windows Answer Tech service did not clarify anything at all.

    Thanks in advance for your help.

    .........................Details...................................................................

    Event Viewer "“ Details tab/XML view

    - <Event xmlns= "http://schemas.microsoft.com/win/2004/08/events/event ">
    - <System>
    <Provider Name= "Microsoft-Windows-Defrag" />
    <EventID
    Qualifiers= "0 ">258</EventID>
    <Level>0</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime= "2014-04-03T14:49:41.000000000Z" />
    <EventRecordID>1777</EventRecordID>
    <Channel>Application</Channel>
    <Computer>VAIO</Computer>
    <Security />
    </System>
    - <EventData>
    <Data>defragmentation</Data>
    <Data>Recovery</Data>
    <Binary>00000000D5010000C10100000000000022B651A2296BEDD85E9C8D030000000000000000</Binary>
    </EventData>
    </Event>

    Event Viewer "“ Details tab/XML view

    - <Event xmlns= "http://schemas.microsoft.com/win/2004/08/events/event ">
    - <System>
    <Provider Name= "Microsoft-Windows-Defrag" />
    <EventID
    Qualifiers= "0 ">258</EventID>
    <Level>0</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime= "2014-04-03T14:49:41.000000000Z" />
    <EventRecordID>1776</EventRecordID>
    <Channel>Application</Channel>
    <Computer>VAIO</Computer>
    <Security />
    </System>
    - <EventData>
    <Data>retrim</Data>
    <Data>Recovery</Data>
    <Binary>00000000190200000B0200000000000022B63823DBB1BD381B0700000000000000000000</Binary>
    </EventData>
    </Event>
     
  2. 2014/08/20
    SpywareDr

    SpywareDr SuperGeek WindowsBBS Team Member

    Joined:
    2005/12/31
    Messages:
    3,752
    Likes Received:
    338

  3. to hide this advert.

  4. 2014/08/20
    andrea23

    andrea23 Inactive Thread Starter

    Joined:
    2014/08/20
    Messages:
    21
    Likes Received:
    0
    Hi SpywareDr, thanks for your feedback. I had a quick look at it and it really contains useful information about how Windows deals with SSDs; however, I think that it does not really addresses my case. The potential defragmentation of my SSD was caused by running the defrag command on command prompt, and not a bug on Windows maintenance.
     
  5. 2014/08/21
    Arie

    Arie Administrator Administrator Staff

    Joined:
    2001/12/27
    Messages:
    15,174
    Likes Received:
    412
    The only way I know of you could check if defrag has run or not is to use software to read the SMART data reported by the drive.

    Intel's SSD toolbox does that for my Intel drives. If I run defrag manually (cmd prompt) I can see that the "Host Writes" value increases by around 10 Gb (on a bare Win 8.1 install) and around 20 Gb on my 'production' system.

    As I have written in my article Optimize Windows 8 for use with a Solid State Drive (SSD)

    Most consumer-grade SSD manufacturers offer a 3 or 5 year warranty with usage patterns that would allow 20 GB of host writes per day.

    I see that Windows 8.1 reports that it ran the TRIM command once every 28 days (by design), and directly after it reports that it has defragmented the drive.

    According to Microsoft sources this is an error in reporting and no actual defrag takes place. Others are disputing this claim. I have now taken a note to check my host writes value the day before the task is set to run again (8/30), so maybe I'll be able to say with quite some certainty if defrag actually runs.

    Not that I would consider it a problem on my system, like I explained above, consumer SSD's are guaranteed with usage patterns that would allow 20 GB of host writes per day, so if there's one day a month that exceeds that, not much harm done IMHO.
     
    Arie,
    #4
    andrea23 likes this.
  6. 2014/08/21
    Bill

    Bill SuperGeek WindowsBBS Team Member

    Joined:
    2002/01/11
    Messages:
    3,332
    Likes Received:
    389
    And I have read others (whom I trust) confirm that this is true. Part of the problem is "Optimize Drives" (or "Storage Optimizer" - the new official name of the Windows 8.x defragging program) performs several tasks, including defragging "hard" drives, among other things.

    But from my understanding (and I'm a hardware guy so perhaps Arie can verify) Optimize Drives uses data obtained from Winsat (Windows Assessment Tool) which, among other things determines what type drives you are using. If SSD, Winsat reports that to Optimize Drives, which then disables defragging only on that SSD drive. It does NOT disable other features, like TRIM.

    So, with W7, you will see that defragging has been disabled for the SSDs. But with W8.x, because the tool is new and does much more than defragging, you will still see it enabled for SSDs as well.

    See this Microsoft Answers thread and note the following from Microsoft:


    This is just another example where we as users, and we as help providers MUST REMEMBER that not all Windows are alike. What was true with XP is most likely not true at all with W8, or even W7.
     
    Bill,
    #5
    andrea23 likes this.
  7. 2014/08/21
    andrea23

    andrea23 Inactive Thread Starter

    Joined:
    2014/08/20
    Messages:
    21
    Likes Received:
    0
    Thank you for your reply, Arie. There is something which called my attention in your article when you say that there is "NO evidence that the Automatic Maintenance will actually run a defrag ". If that is true, should I assume then that it is not possible to run in practice a defrag through command prompt since both the Optimization tool (GUI) and cmd make use of the same file (defrag.exe) to perform a defragmentation (also assuming that Windows has perfectly detected the SSD)?

    Thanks.
     
  8. 2014/08/21
    andrea23

    andrea23 Inactive Thread Starter

    Joined:
    2014/08/20
    Messages:
    21
    Likes Received:
    0
    Hi Bill, thank you for your input. That's a relief to a certain extent for me since I have Windows 8.1 installed on my laptop, which prevents from running a traditional defrag through the Storage Optimizer; however, that does not apply to my case since the defrag command was run on cmd and not through the Storage Optimizer. My doubt is: does Windows 8.1 also prevents a SSD from being defragged through cmd the same way as it does through the Storage Optimizer?

    Thanks.
     
  9. 2014/08/22
    Bill

    Bill SuperGeek WindowsBBS Team Member

    Joined:
    2002/01/11
    Messages:
    3,332
    Likes Received:
    389
    Note in W8, it is not even called a defragger. When you manually start "Optimize Drives" in Windows 8.x, you will see a list of your drives. They will be listed under Media Type as Solid state drive, or Hard disk drive, depending on type.

    If you manually select "Optimize" on your SSD, you can see it reports the "trimmed" percentage. No mention of defragging.

    If you manually select Optimize on your HD, you will see it reports the "defragged" percentage.

    Running the command from a command prompt makes no difference. It is the same "optimize" program - just without the fancy Windows user interface.

    So, to answer your question, in spite of some of the dumb things Microsoft does (especially their marketing and PR departments), the developers are not dumb and Windows 8 really is a good OS, and can tell the difference between a SSD and HD and act accordingly. As noted by Microsoft,

    So contrary to your comment above, it does indeed "apply to your case" even when run from the command prompt.

    And regardless, with the latest generations of SSDs, no "harm" would be done even if defragging was actually able to run on the SSD. The latest generations of SSDs do not suffer from a restrictive limit on the number of writes like the first generation of SSDs did. So the main reason today for not running defrag on a SSD is simply because it is a waste of time. "Defragging" - that is, rearranging the saved file segments so they are saved sequentially in adjacent tracks provides absolutely no advantage on a SSD. This is because each storage location on the SSD is accessed directly. No Read/Write head needs to be physically moved and positioned over the file segment of a spinning disk, then moved again to pick up the next file segment, and again and again.
     
    Bill,
    #8
    andrea23 likes this.
  10. 2014/08/23
    andrea23

    andrea23 Inactive Thread Starter

    Joined:
    2014/08/20
    Messages:
    21
    Likes Received:
    0
    Hi Bill, thank you very much for your answer. Now I can understand clearly how optimisation works in Windows 8.1. I assumed that defragmentation on GUI and on command prompt through the defrag command were executed using different methods; but I was not aware that they both execute the same command/program (defrag.exe) and the only thing which changes is the way it is displayed to the user (please let me know if this is correct). Your explanation has perfectly answered my question and all makes sense to me. So, "yes!, it really applies to my case ".

    In conclusion, should I assume then that Event Viewer registered the defrag event (because the defrag command was actually invoked on command prompt) but the "traditional" defragmentation process was immediately aborted/not even started (because Windows 8.1 detected the SSD) and was automatically replaced by the TRIM command? That would explain why the TRIM event was also registered at the same time. Is this correct?

    Just a quick doubt, please: my Optimizer tool distinguishes between the C: drive and Recovery partition (both SSD type) to be optimized, so it displays the number of days that optimization has not been run for both. Should I also optimize the Recovery partition?

    Many thanks for your help. I really appreciate it.
     
  11. 2014/08/23
    Bill

    Bill SuperGeek WindowsBBS Team Member

    Joined:
    2002/01/11
    Messages:
    3,332
    Likes Received:
    389
    Thanks. And yes, you are correct, and yes it does apply to your case.

    When I look in my Event viewer for "Defrag" Source events, for my HDs, it says (my bold added), "The storage optimizer successfully completed defragmentation on [my HD drive name and letter] ".

    For my SSD, it says, also under "Defrag" source events, "The storage optimizer successfully completed retrim on [my SSD drive name and letter] ". This illustrates that even though both "events" are coming from the same source, "Defrag ", the actions taken were different.

    No. It is not needed. And for that matter, pretty sure Windows will not let you. You can click Optimize, but it will not optimize the drive, or change the current status.

    So IMO, there is a status documentation bug there and it should NOT say, "Needs optimization ".

    And as I said, the recovery partition does not defragging anyway. Remember, defragging is required when files are saved, modified, saved, modified, deleted, added, modified, saved, deleted, added, etc., etc. That's when file "sizes" change, forcing the system to break up files into segments scattered about. The file or files on the system recovery partition are rarely, if ever, modified. So the segments tend to already be optimized/defragged.
     
    andrea23 likes this.
  12. 2014/08/23
    andrea23

    andrea23 Inactive Thread Starter

    Joined:
    2014/08/20
    Messages:
    21
    Likes Received:
    0
    Hi Bill, thanks again for your quick reply. Your feedback has triggered a couple of more questions (hope you don't mind):

    1. When I look in my Event viewer for "Defrag" Source events, for my HDs, it says (my bold added), "The storage optimizer successfully completed defragmentation on [my HD drive name and letter] ".

    This is precisely one of the reason why I posted my question: my Event Viewer shows two entries registered at exactly the same time: "The storage optimizer successfully completed defragmentation on Recovery [partition] "; and "The storage optimizer successfully completed retrim on Recovery [partition] ". Defrag and Retrim for Recovery??!! I suspect that there is a bug on Windows 8.1 (at least, in my installed version).

    2. ...pretty sure Windows will not let you. You can click Optimize, but it will not optimize the drive, or change the current status.

    So IMO, there is a status documentation bug there and it should NOT say, "Needs optimization ".

    Unfortunately, my Optimize tool says "Needs optimization" for the Recovery partition; therefore, there must be another bug on my Windows. Until now, the Recovery partition has been optimized since it also displays the same current status as the C: drive ( "Needs optimization) and was detected as SSD type, so I thought it was necessary to do it. Every time I clicked on Optimize bottom for Recovery on GUI, Windows performed the same TRIM process as for C: drive, showing the percentage on a progress bar. Hope the Recovery partition has not been damaged by doing so. Nevertheless, I have unchecked the Recovery partition for optimization after reading your feedback, so only the C: drive is optimized now.

    What do you think?
     
  13. 2014/08/23
    SpywareDr

    SpywareDr SuperGeek WindowsBBS Team Member

    Joined:
    2005/12/31
    Messages:
    3,752
    Likes Received:
    338
    Optimizing/Defragging a SSD wears it out, (because there are a finite number of times that each storage location can be written to).

    If you've already accidentally done it once, there is nothing that can be done about it. Just simply avoid doing it again.
     
    andrea23 likes this.
  14. 2014/08/23
    Bill

    Bill SuperGeek WindowsBBS Team Member

    Joined:
    2002/01/11
    Messages:
    3,332
    Likes Received:
    389
    While both facts are true, (1) you should not be allowed to defrag if using Windows defrag tool, and (2) as noted before, the "finite" number of writes on "current generation" SSDs is no longer a problem. While the number is still finite, even with today's budget SSDs, the number is so huge, it would take decades to reach it.

    There are exceptions, of course, but for home consumers, no worries.

    And BTW, running defrag on HDs wears them out too.

    As I noted, so does mine. I'm not worried about it and neither should you.

    I think you should worry about keeping your computer and security programs updated, and avoid being click happy on unsolicited links, downloads and attachments and stop worrying about defragging your drives - and let the OS do its job. It really is pretty good at it.
     
    andrea23 likes this.
  15. 2014/08/23
    SpywareDr

    SpywareDr SuperGeek WindowsBBS Team Member

    Joined:
    2005/12/31
    Messages:
    3,752
    Likes Received:
    338

    Agreed. But I'm not sure it really can, or does anyway ... simply because nothing really needs to moved anywhere.




    Dependant on how much the drive is written to of course.




    For most home consumers, probably so, yes.




    And NOT defragging could potentially wear them out even faster. ;)




    +1
     
    andrea23 likes this.
  16. 2014/08/23
    Bill

    Bill SuperGeek WindowsBBS Team Member

    Joined:
    2002/01/11
    Messages:
    3,332
    Likes Received:
    389
    That's what we've been saying all along - the integrated Optimize disk program in Windows recognizes a SSD, then disabled the defragging feature.

    But 3rd party defraggers may not be as smart, or conscientious.

    Not really. Whether the R/W head has to move to the next sector, or across the platter for the next file segment, it still has to move and position itself over the next segment, and the platters are still spinning.

    Pretty much all a heavily fragmented disk does is slow down performance.
     
    andrea23 likes this.
  17. 2014/08/23
    SpywareDr

    SpywareDr SuperGeek WindowsBBS Team Member

    Joined:
    2005/12/31
    Messages:
    3,752
    Likes Received:
    338
    Ever actually watched one in action? A severely fragmented hard drive is yanking the entire reciprocating head mechanism back and forth in a wildly random pattern constantly. And in a properly defragmented drive, the heads are usually barely wiggling.

    Moving parts cause wear, and hence the more movement, the more wear. And, once that wear becomes great enough, it's TITSUP (total inability to support usual performance).
     
  18. 2014/08/23
    Bill

    Bill SuperGeek WindowsBBS Team Member

    Joined:
    2002/01/11
    Messages:
    3,332
    Likes Received:
    389
    Exceptions don't make the rule. Yes I have seen severely fragmented drives, years ago. But there is no reason today for any drive to be severely fragmented. That indicates severe neglect on the part of the user. They either disabled automatic defragging and failed to periodically manually defrag and/or they failed to maintain sufficient free disk space.

    Since Vista, defragging has been automated. And with the cost of monster disk drives - 3Tb drives dropping to $110, and a host of 500Gb for under $50, there really is no excuse.

    The number of times the R/W head starts and stops is more significant than the distance it travels between stops. And the number of times is the same, regardless if reading/writing to adjacent sectors, or separated sectors. So yes, technically you are right, but again, the number of movements is way more significant than the distance the arm travels.
     
  19. 2014/08/23
    SpywareDr

    SpywareDr SuperGeek WindowsBBS Team Member

    Joined:
    2005/12/31
    Messages:
    3,752
    Likes Received:
    338
  20. 2014/08/31
    Arie

    Arie Administrator Administrator Staff

    Joined:
    2001/12/27
    Messages:
    15,174
    Likes Received:
    412
    OK, so I'm pretty confident I can say that Windows 8 does indeed defrag an SSD drive.

    I have been recording my daily read & write counters, and the day before the defrag took place my daily total for those counters read:

    Reads 110
    Writes 403

    Now, just after Event viewer shows

    The read/write counter show:

    Reads 764
    Writes 1,064

    So that's the proof AFAIC.

    The raw value reports the total number of sectors written by the host system. The raw value increases by 1 for every 65,536 sectors written by the host.

    So I can calculate around 23.875 Gb reads and 33.25 Gb writes.

    The defragmentation only happened about 1 hour after startup, and the previous days values were recorded prior to shutdown.
     
    andrea23 likes this.
  21. 2014/08/31
    Bill

    Bill SuperGeek WindowsBBS Team Member

    Joined:
    2002/01/11
    Messages:
    3,332
    Likes Received:
    389
    An increase of just 600 writes is "proof" of a defrag? I don't see it. How many files are on this drive?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.