Disk Defragmenter in Windows 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 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 re-placed. 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 Disk Defragmenter in Windows 8 / 7 explained

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 dmp 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 run 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, seee this post on Disk defragmenter could not start or Failed to initialize.

In Windows 8, while the  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.

Posted by on , in Category Windows with Tags
Anand Khanse aka HappyAndyK is an end-user Windows enthusiast, a Microsoft MVP in Windows, since 2006, and the Admin of TheWindowsClub.com. Please create a System Restore Point before trying out any software & be careful about any third-party offers while installing freeware. Add me on Google+.
  • 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.

  • 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.

  • 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.

  • Recent Comments