Disk Defragmenter in Windows 10/8/7 explained

Starting with Windows Vista, the built-in Windows Disk Defragmenter has been much improved upon, and more so in Windows 8 and Windows 7, and is considered to be much better than its predecessor Windows XP. The defrag engine and the manageability of fragmentation have been improved. The Disk Defragmenter runs as a low priority task in the background without affecting the performance of the computer. It runs only when the machine is idle! It uses the Task Scheduler to automatically keep the hard disk defragmented. This automated defragmentation does not affect the performance of the Windows.

Disk Defragmenter in Windows 10/8

Now, by default, the defrag tool only defragments files smaller than 64 MB, for according to Microsoft’s benchmarks, fragments of this size, which already consist of at least 16000 contiguous clusters, have a negligible impact on performance. This means that games and large media files are effectively left as they are! So if you still want to defrag files larger than 64 MB too, you need to use the -w parameter mentioned below to defragment files of all size.

Starting with Windows 7, defragmentation became even more comprehensive – many files that could not be re-located in Windows Vista or earlier versions can now be optimally replaced. In particular, a lot of work was done to make various NTFS metadata files movable. This ability to relocate NTFS metadata files also benefits volume shrink, since it enables the system to pack all files and file system metadata more closely and free up space “at the end” which can be reclaimed if required.

In Windows 7, Microsoft had turned off defragmentation for Solid State Disks. In Windows 8 however, since the tool has undergone a change into a general disk optimization tool, you will see it enabled by default for SSDs too. You can read more about the Improved Disk Defragmenter and Storage Optimizer in Windows 8. If you use a Solid State Drive, you may want to read this post on Defragmentation and SSD in Windows 8.

The Disk Defragmenter process starts according to a schedule that you can adjust. You can open the Disk Defragmenter in Windows 8 or Windows 7, by right-clicking on a Drive’s icon, selecting Properties and clicking on the Tools tab.

Disk Defragmenter in Windows 8

Here, you can change settings by clicking on the Change settings button and opt to run scheduled scans on a daily, weekly or monthly basis. or choose to defragment “now’ by clicking on Analyze or Optimize.

Some Points To Remember:

  • Disk Defragmenter does not defragment files in the Recycle Bin. It is best to run Disk Cleaner first and then empty the Recycle Bin before defragmenting
  • Disk Defragmenter will also not defragment files which are in use. Best to try and shut down as many processes as possible and then defragment.
  • Disk Defragmenter does not defragment the following files: Bootsect DOS, Safeboot fs, Safeboot CSV, Safeboot RSV, Hiberfil sys, Memory dump and the Windows page file. However using the -b parameter, as mentioned below, will optimize the boot files.

Disk defragmenter Command line options

There are various command line options for you to exercise control over the defragmentation process.

To defrag a specific drive, say Drive C, open a command prompt and type:

defrag c:
You can use the following parameters or switches with the Defrag command to further fine-tune your control:

-r  This is the default setting and defragments file fragments that less than 64 MB.

-a  Analyze the selected drive / volume & display a summary report, consisting of analysis and defragmentation reports.

-c  Defragments all volumes on the computer. Don’t specify a drive letter while using this.

-w  Perform FULL defragmentation of files of ALL sizes.

-f  Forced defragmentation even when there is less amount of free space on the drive being defragmented. A volume must have at least 15 % free space before Disk Defragmenter can completely defragment it.

-i  This makes Defrag run in the background & operate only if the computer is idle, like when running as a scheduled task.

-v  Displays complete reports.

-b  It optimizes boot files and applications only.

The only indication you will get is a blinking cursor. This means that the process is going. To interrupt the defragmentation process, press Ctrl + C in the command window.

You can read more here on Defrag Options & Command line switches.

Disk defragmenter does not run

If you find that you are unable to defragment or cannot run the defragment utility in Windows or that a drive or volume has been marked as having errors, run chdsk by entering

chkdsk c: /f

at any command prompt; where c is the drive letter. You will be able to then run Defrag after Chkdsk has repaired the file system. If you still face problems, see this post on Disk defragmenter could not start or Failed to initialize.

In Windows 10/8, while the default defragger is good enough for most of us, there are some who prefer to use Free Defragmentation Software. You may want to have a look at these too.

Do you know about the Hidden Partitions displayed in Disk Defragmenter Tool?

Posted by on , in Category Windows with Tags
Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP Awardee in Windows (2006-16) & a Windows Insider MVP. Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.


  1. Andrey de Oliveira

    In defrag of my Windows 8.1 have only /A, /C, /D, /E, /H, /K, /L, /M, /O, /T, /U, /V, /X. parameters. The /W /F /I and /B is missing. The /K is too obscure to mee.

  2. Viswanath

    Mr. Khanse, I’m posting my query here even if it is irrelevant to the topic of discussion since I couldn’t find any helpful response on the forum. I’m using Windows 8.1 and while most of the apps work totally fine, few apps like fb, twitter, the hindu, espn etc. have trouble connecting to internet via institute proxy. Have checked the app settings to see if proxy settings can be incorporated individually in each app but that didn’t help either. Can you please suggest what could be the issue is and how to solve it? Thank you.

  3. Josh Derak

    I would like to ring in with this Windows doesn’t defrag files over 64MB. That’s only half correct. What happens is that Windows 7/8 will defrag large files down to 64MB chunks. So if a file is 1GB and is fragmented all over the place, Windows defrag will in fact defrag that file BUT will reduce the file down to about 16 fragments. Microsoft’s reasoning for this is that performance no longer diminishes at this point. I can imagine some circumstances where a file will perform better when defragmented 100% but for most cases, 64MB chunks are good enough.

    The research on this matter as lead me to believe that 100% defrag is overkill. An OS will be constantly reading files from all over a disk anyway. Modern drives are large enough that fragmentation is not an issue just as long as you have plenty of free space. Defrag can try to organize files so the most used are closer together but that’s a constantly changing state of affairs. Lets say you listen to podcasts. Each time iTunes downloads a podcast, it will fragment it all over the place. But you will only listen to that podcast ONCE and then delete it. Here’s the thing: All that happens is that file will read once. There’s no need to defrag it but some defrag programs are aggressive and will defrag that file regardless. By the time you’re done with that file, you will have synced your iPod or whatever back to iTunes, it will tell iTunes that the file has been read and it’s no longer needed and it’s deleted. Defrag in this case did nothing but waste resources. For a defrag program to work efficiently, it would have to know which files will be permanent and which files will be temporary. As of this posting, I know of no defrag programs that have a setting to only defrag a file if it is a particular age which would be a more efficient way to defrag than immediately and constantly defragging everyhing.

    The worse culprit for this is Diskeeper. It will never ever stop defragging. 24/7 disk churning. I don’t know how that is supposed to be more efficient. I can only think every single positive thing said about Diskeeper online has been from shills. Yes, it only runs when the computer is idle. Sounds great when you put it that way but a computer is idle most of the time. It’s idle between keystrokes.

    I have tried other Defrag programs such as PerfectDisk, O&O, Diskeeper, Defraggler, UltimateDefrag, MyDefrag and SmartDefrag. All of them did the same annoying thing: they defragged too much. The default is to take all the files and mush them closely together and order them in some manner that requires the defrag to move around way too many files at each run. The problem with that is the new files written to the disk are pushed to the back. In a way, this is worse than defragging because now the disk has to reach even farther to get that new file when the other files in that collection are closer to the front.
    As far as I’m concerned a lot of defrag programs exaggerate the issue of fragmentation and make claims it will prevent crashes which is ridiculous. How exactly would a fragmented file cause a crash? It’s only possible if that file is on a bad sector. I think it’s possible that defrag keeps files from suffering Bit-Rot by moving the files around and ultimately placing the file on a freshly refreshed sector and it could be possible the old sector was getting errors which CRC would correct when read and then placed somewhere else. Who knows? Probably snake oil for the most part. Seems most people will believe/disbelieve anything at random so it doesn’t matter. If defragging your hard drive everyday makes you think you’re helping, go ahead. I can bet you for most people, they wouldn’t be able to tell the difference between a heavily fragmented drive and a one that’s degragged. If you can tell, congratulations, you have probably used a stopwatch.

    Windows 7/8 defrag is minimalistic which is great because it defrags just enough to improve performance but doesn’t continue moving files in vain just to make sure everything is close together.
    I’ve read why there’s no need to defrag in Linux. It’s because the file system spreads all the files farther apart which reduces the chance that a file will increase in size and would need to be placed around the disk in more than one contiguous path.

  4. Defragging a drive is essential for the smooth functioning of the computer. I usually prefer to use a utility like Ccleaner or Ninja TuneUp to defrag and to remove the junk files from the system.

  5. Douglas Cohn

    Can you please show some evidence as to why you run Ninja TuneUp or CCleaner. Without the need these programs can cause more harm then good especially if run just because someone posted that they do it.

    If you control yourself and do not install unknown software or any software you absolutely do not need then you also do not need to install CCleaner. I know the product very well and there are situations where it will help but rarely does a system used by a careful user require such a product,

    If it did require it then Microsoft would have built it in by now, just like antivirus, antispyware and defrag which as you see has grown more powerful over the years as it improved performance. To repeat if CCleaner had a noticeable performance improvement on most systems then Microsoft would have their version of it included.

    My research shows that most systems do best never installing those tools unless you are having issues and someone that truly understands what is going on with your system based on running diagnostic utilities and reading the resulting logs.

    Bottom line defrag and CCleaner are unrelated and this is a defrag thread. My fear is people read this and run out and install that stuff. True it rarely if ever creates a problem but it also rarely improves a system that had just the basic email, office and web usage.

    My 2 cents. I have been in the it field since 1987 but hey that does not mean anything I say has any more value than someone that started last month. I have experience in real world situations and can troubleshoot better than most but still I am open to hear why what I just said is bunk since I also have no hard data to back it up.

    Enjoy your computers……..


    i have done the de fragmentation and optimization of disk drive :C ,,but after the process is completed,,now i can not open any functions of WIndows 8,,nothing open,,,PC settings crashes,,mail crashes,,store crashes and it feel like windows 8 is no more on my system altough its showing im on windows 8.1,,plzz help me

  7. DCP the Lesser

    The four options you list still are there; just hidden. I used the /W and /B all the time on Windows 8.1, and still use them today on Windows 10. The /F parameter also is there but hidden, and is only useful if your available hard drive space is less than 15% (or, something like that).

    I do not know about the /I parameter as I never used it. What it was in Windows 8.1 I don’t know. I never used that one. In Windows 10 there is an /I n parameter for setting time limits on tier optimization.

    The /K option is for use in such things as virtual machines and/or other ‘thin-provisioned’ storage arrangements. Most people aren’t going to use that last one.

  8. DCP the Lesser

    Do you remember which options you used in the defrag? What you are describing sounds like what I experienced after using Piriform Defraggler. Did you use any defragmenting programs other than Windows Defrag prior to using Defrag in windows? If so, logon using Safe Mode with Command Prompt and run defrag c: /b /w /h /u /v and wait. Then, follow that up with the same except without the /b parameter. If you can fun defrag c: /w /h /u /v from the advanced repair options, you should try that. Of course, you probably already reformatted and reinstalled Windows 8.1 by now, so keep this for future reference.

  9. DCP the Lesser

    One correction. Linux does have a few defraggers. One is built-in and requires the command line to set and change the parameters of EXT4 filesystems that instruct the drivers how to handle and work with the filesystem. Another is e4defrag, which is a simple command-line defragger. That defragments file extents on EXT4 filesystems. I use that one after every major upgrade. Btrfs on Linux also has defragmentation methodologies built into the utilities that go with btrfs.

  10. Josh Derak

    Excuse me, how is what you’re saying a correction? I never said there were no defraggers for Linux, I’ve read that there was no need to defrag a hard drive in Linux. Those are two separate things. Of course there are defraggers for Linux as the file systems are capable of being defragged.

  11. Josh Derak

    Ninja TuneUp looks like a gigantic bottle of snake oil. And CCleaner doesn’t have a defrag function.
    Windows has fairly adequate cleaning and defrag tools built into the OS.
    Every product that claims to speed up a PC is lying. The only things that would make a PC go faster would be to make sure there’s no malware running in the background, reduce the amount of things that start up with the PC or a reinstall of the OS.

  12. DCP the Lesser

    And that still requires a correction because while most users likely will never need to defragment an EXT4 system on Linux (the OS filesystem handles that fairly well), some still do have fragmentation issues, depending upon the kinds of files stored in the filesystem and the kind of work done on the system, and also depending upon the sizes of the files involved. That is why people have written Linux-based defraggers, including those who write the components to the filesystem, particularly in the case of Btrfs. Even Linux systems can get their files fragmented under certain circumstances. This is especially so if you do a lot of development on a Linux system.

  13. Josh Derak

    What are you correcting? I never said there were no Linux defraggers. I only brought up Linux because of how files are placed and you’re taking that out of context and making it about something else. This is discussion of Windows defrag and I don’t want to spend my time splitting hairs.

Leave a Reply

Your email address will not be published. Required fields are marked *

9 + 7 =