Thoughts from the EPS Windows Server Performance Team
When addressing system performance issues, a key element that is often overlooked is Disk Fragmentation. Even on a brand new system with plenty of RAM and high-end processors, the performance of the hard disk may be a bottleneck causing system performance issues. It takes time to load large data files into memory - issues become particularly noticeable when dealing with movies, video clips, database files or .ISO image files which may easily be several gigabytes in size. On a freshly formatted disk, these files load fairly quickly. Over time, however you may start to notice performance degradation - caused by disk fragmentation.
We touched on disk fragmentation when we were discussing the Page File a couple of months ago, but we never really got into the nuts and bolts of it. To understand disk fragmentation though, you need to understand the basic structure of hard disks. When you format a hard disk, the formatting process divides the disk into sectors, each of which contains space for 512 bytes of data. The file system then combines groups of sectors into clusters. A cluster is the smallest unit of space available for holding a single file - or part of a file. On NTFS disks, the cluster sizes are determined based on the drive size as shown below (this information is also available in Microsoft KB 314878). When formatting disks it is possible to change the cluster size, however this may cause additional performance issues.
Using the information above, if you were to take a 100MB video file, the file would be divided into roughly 25,000 pieces. If you save this 100MB file onto a freshly formatted disk, the information would be written in contiguous clusters. Since all of the clusters holding the data for this file are physically adjacent to each other, the mechanical components of the hard disk work very efficiently, pulling the data in one operation. In addition, the hard disk's cache and the Windows disk cache can anticipate data requests and fetch data from nearby clusters. This data can then be retrieved by an application from cached memory which is faster than retrieving the information from the disk itself.
Seems pretty straightforward, right? The problem is that the hard disks don't stay neatly organized for very long. Whenever you add data to an existing file, the file system has to allocate more clusters for storage. Typically, these clusters wind up being in a different physical location on the disk. As you delete files, you create gaps in the arrangement of the contiguously stored files. As you save new files (and this is especially true for large files), the file system uses up all of these bits of free space - resulting in the new files being scattered all over the disk in noncontiguous pieces. And thus we end up with fragmented disks and system performance issues because the disk heads have to spend time moving from cluster to cluster before they can read or write the data.
Enter Disk Defragmenter. This utility physically rearranges the files so that they are stored (as much as possible) in physically contiguous clusters. In addition to the consolidation of files and folders, the Defragmenter utility also consolidates free space - meaning that it is less likely for new files to be fragmented when you save them. For operating systems prior to Windows Vista, you had to manually run the utility or schedule automatic defragmentation via a scheduled task. On Windows Vista, Disk Defragmenter runs as a low-priority background task that is automatically run on a weekly basis without requiring user intervention. On Windows Server 2008, which uses the same Disk Defragmenter, the automatic defragmentation is not enabled by default. Also, the color-coded display that was part of earlier versions of the utility has been retired (believe it or not, more than a few people have asked about that!). Aside from the GUI version of the tool, you can also use a command-line version that enables some more granular control over the process. The utility name is DEFRAG.EXE and does require administrative privileges to run. The basic operation of the utility involves passing it a driver letter, for example: defrag.exe c: would perform a defragmentation of the C: drive. You can also specify other options through the use of command-line switches:
So now that we've covered what disk fragmentation is and how to address it, there are some caveats. You must have at least 15 percent free space on the disk volume before Disk Defragmenter can completely defragment the volume. If you have less free space, then a partial defragmentation will occur (unless you force the defragmentation with the -f switch). Also, you cannot defragment a volume that has been marked by the OS as possibly containing errors. This is where you would need to use the CHKDSK.EXE utility to ensure that there are no underlying disk issues. Some other things to look out for:
And with that, it's time to wrap up this post. Until next time ...
- CC Hameed
I've been defragging 2-3 times a week using WDD (on Windows XP laptop) for about 2 years now and I haven't got any issues whatsoever.
I also don't think defragmenting in a row is harmful if you don't do this too often.
I try to defrag my system and I get the error message "Disk Defragmenter could not start". How do I fix the Disk Defragmenter?
I just installed a new disk in my PC and copied over some big files (mainly virtual machine images) using Windows Explorer. Disk defragmenter now tells me that this new disk is seriously fragmented. All I've done is copy some files to it and set the permissions.
Any idea what's going on?
I have tried to defrag my system and now it says "Disk Defragmenter could not start." How do I fix this?
I also have tried to get this to work in the command prompt with the same response.
Just wanna say thanks to the author(s).Quite educative.
"disk defragmenter could not start"
in both the program and dos instances
Does anyone ever answer these messages? The same question has been posted numerous times...
I keep getting the same message "Disk Defragmenter Could Not Start" no matter which drive i try to defrag.
How do i solve this?
For those having issues with the "Disk Defragmenter could not start", I am assuming that you are running the utility using an account with administrative privileges. If you are, and you are experiencing the issue, please check the following:
1) Verify that you actually have a page file. If the page file is zeroed out, this may cause the issue.
2) Verify that the Logical Disk Manager service is set to Automatic and started
3) Verify that the DCOM Server Process Launcher is started (primarily a Windows XP issue)
4) If you have a third-party utility installed that performs disk defragmentation, this may cause the native Disk Defragmenter utility to fail. In this instance, you will need to re-register the files for Disk Defragmenter:
- from a command prompt change to the %systemroot%\system32 folder
- run the following commands
5) If Disk Defragmenter does not work, browse to c:\windows\inf, and find the dfrg.inf file. Right click this file, select Install.
Hope this helps!
Please see the following non-MS resources:
I want to get a list of the files that could not be defragmented. With Windows XP it was easy, but with Vista the defragmentation just ends. How do I get the list?
I get the error message: Disk Defragmenter Could Not Start. How do I fix this?
I also got "Disk Defragmenter Could Not Start" ? how do i fix this
when do you plan to update this post with windows 7 functionality? It looks like windows 7 has changed a few things in this area.