The Storage Team Blog about file services and storage features in Windows and Windows Server.
[Last updated 4/26/07]
Why did you simplify the Disk Defragmenter interface?The Windows Vista Disk Defragmenter was simplified primarily for the purpose of removing it out of the face of the user. It runs periodically and keeps your file system fragmentation at acceptable levels, making it unnecessary for you to launch the tool itself. With the new UI, you can see that we really don't want defrag to be something that people have to worry about, just like any number of other low-level capabilities in the OS.
The new interface seems “dumbed down.” Why remove all the detail?Interestingly enough, one of the biggest and consistent complaints we had from users (broad sample here from home users to experienced IT Pros) in the past was that a vast majority of them had no idea what the detailed fragmentation statistics they saw meant. The Windows XP graphical view also had some limitations and inaccuracies that prevented it from being included in Windows Vista. If you really want to keep a close eye on fragmentation, I'd recommend using the command-line tool Defrag.exe.
Why was the defrag progress indicator removed?Part of the problem with the Windows XP defrag tool was that percent complete was not accurate or meaningful. Depending on the phase of defrag, 1% of progress could take from several seconds to minutes, which made the progress indicator highly unreliable. The difficulty here is that since defrag is a multi-pass process (multiple iterations of file defragmentation and free space consolidation) there is no way to accurately predict when defrag will complete since the number of loop iterations and how long each takes are highly dependent on the layout of the files on the volume, the level of file and free space fragmentation, and the other system activity. While I agree that having no progress is bad, misleading progress I believe is worse. Also, the idea behind the new automated defrag is that users will not have to think about it not worry about the progress it is making. With defrag running regularly, the system will be close to optimal levels of fragmentation, and subsequent defrag runs should not take long.
What about if the computer is off when it is supposed to be defragmented? When will the next defrag take place?Disk Defragmenter will run when the computer comes back up for the first time after the missed scheduled task. The tasks scheduler team has implemented some nice safeguards to limit the impact of such “missed” tasks on system performance. More specifically, execution of such tasks will be delayed by a few minutes so that they do not interfere with a computer booting up or resuming from hibernate/sleep. In addition, such tasks are serialized and occur one at a time.
At this point, people are typically scared that defrag will run when there is an interactive user on the system and make the machine unusable. This was definitely the case in Windows XP and Windows Server 2003, but Windows Vista defrag uses low-priority I/O and low priority CPU, which limit the impact defragmentation has on user activity.
How does defrag use low-priority disk I/O and CPU? Defrag always uses low priority CPU and disk I/O except when defragging the MFT (to prevent long blocking periods on the MFT). The type of defrag you choose (scheduled or manual) makes no difference. Using low priority CPU and disk I/O does not prevent Defrag from using more system resources when you are not using the computer, such as when the scheduled defrag runs overnight. You can see this by running the command-line version of Defrag with just your Task Manager running. Defrag will eventually take a lot of resources, but if you start doing something else on the computer, Defrag will back off. This means that the defrag process will be slower when you use the computer, but then again, you won’t notice the same hit on performance as you did using the Windows XP Defragmenter.
When I dual-boot into Windows XP, the defrag results are different from Windows Vista. Why?The fact that you can see different levels of fragmentation from Windows XP and Windows Vista is not necessarily unexpected. The reason is that Windows XP and Windows Vista use slightly different algorithms for determining which files are fragmented and which files can benefit from fragmentation. On Windows XP, any file that is split into more than one extents is reported as fragmented and the Disk Defragmenter will try to move it. On Windows Vista, we want to take advantage of the fact that the biggest performance gain from defragmentation is when you combine files in "big enough" extents. "Big enough" here is 64 MB, which happens to be about the extent size for which the disk-seek latency starts to become negligible compared to the latency associated with sequentially reading the extent. This means that the performance benefit of coalescing two extents larger than 64 MB is minimal while the I/O load and free space requirements are significant. The different levels of fragmentation that you see for the same volume from Windows XP and Windows Vista are a result of this different treatment of large extents.
This in no way means that if you run defrag from Windows XP on your Windows Vista partition you will be making things worse. The only difference will be that defrag will be doing more work than necessary and will require more free space (because of the big file moves) compared to the Windows Vista Disk Defragmenter.
The Task Scheduler history shows that Defrag has run at completely random times during day, but I’ve set it to run only weekly (or monthly)! What’s going on?You won’t see this random behavior if the machine is idle and on long enough at the originally scheduled defrag time. On the other hand, if you use the computer most of the time when it’s on, you might notice that the ScheduledDefrag task started and stopped again over a few days in an attempt to make a full run. The ScheduledDefrag task may have run during lunch, during a meeting, on the weekend, or (on your home computer) during a run of television shows you watch. The ScheduledDefrag task runs only when Task Scheduler detects that the computer is idle, typically when there is no user input. Moving the mouse or pressing a key will render your computer “not idle.” Other run-on-idle tasks may get priority over ScheduledDefrag and therefore the task will wait to start. If Disk Defragmenter doesn’t finish a run between one run of “idle” and “not idle,” Task Manager will wait for the next idle condition, wait for any tasks ahead of the ScheduledDefrag in the Task Scheduler queue, and then fire up another ScheduledDefrag task.
(To see a history of defrag-related tasks, open Computer Management, expand System Tools, navigate to Defrag under Microsoft/Windows, and then click the History tab.)
My computer seems sluggish, as if the scheduled defrag is running and slowing down the computer as I work. How can I check to see if Defrag is running?If you are using the computer, the ScheduledDefrag task should not be running. You shouldn’t see Defrag.exe or Dfrgntfs.exe in Task Manager, though you might catch Dfrgntfs.exe running for the couple seconds it takes to close after user activity is detected. (Note that these .exes run under SYSTEM, so you can’t see them in Task Manager without clicking the Show processes from all users button.) If, however, you started Defrag manually, then Defrag.exe and Dfrgntfs.exe will appear in Task Manager and won’t stop when user activity is detected. This manual defragmentation should not cause a significant impact on user activity thanks to defrag’s use of low-priority I/O and low priority CPU.
Which volumes does Defrag defragment?In Windows Vista, Defrag defragments all volumes on the computer.
We've added a couple new questions in our Disk Defrag FAQ to cover questions about defrag running at
Can a developer really be so out of touch with their users! Looks like they can. It would have been simple to have a graphical display with hide button and to add options to defrag particular drives etc.
Or maybe it was just cheaper and quicker to do it this way - and try and persuade us they have done a good job......
The visual display should of been kept, hidden under a "display visual map" button or some such.
Or better idea - make the graphical display a Vista Ultimate Extra - PLEASE PLEASE
i've build a winforms usercontrol in C# .NET 2.0 to be hosted in IE for different maintenance jobs similar to the Live Clean Up Center.
I see the MS folks show the progress for disk defragmentation on the UI, so i thought there is a API to access the defragmentation
with a wrapper or PInvoke. After searching the web up and down for a documentation about the windows defrag API, without a for me usable result, i try to use the built-in defrag.exe. But this piece of software dont give any progress on the screen while running, so output redirection is'nt possible. On this blog now i read why.
So please tell me, is there any undocumented API access to the defrag.exe?
Left Vista defragmenter running all night. Finally, I had to stop it simply because I had no idea where it was: close to finishing? It ran over 14 hours. Perhaps I stopped it just seconds before fully finishing, but that's exactly the reason why I didn't stop it before. It seems to me that some indicator is needed, even more convinced now after reading the posts here.
yavcht123456789: I totally agree with you.