Take advantage of Windows 7's Disk Defragmenter to get detailed drive data

Greg Shultz takes a closer look at Microsoft Windows 7's Disk Defragmenter and describes how to take advantage of the new features.

As you know by now, Microsoft Windows 7's Disk Defragmenter is configured to run on a regular schedule right out of the box. And, when it runs, it is hidden in the background with no visible interface or icon. This means that Disk Defragmenter will always keep your hard disk in tip-top shape and you never even have to think about defragmenting your hard disk.

This is an awesome feature as disk fragmentation can take a huge toll on the overall performance of your operating system. For instance, disk defragmentation can be the source of long boot-times, random crashes, as well as unexplained lock-ups. In fact, an extremely fragmented hard disk can even prevent a system from booting up.

Even though the disk defragmenting operation is totally automated in Windows 7, such that you really never need to manually run the utility, the user interface in Disk Defragmenter has been redesigned so that it can provide you with detailed defragmentation status information, allowing you to monitor the progress of the operation if you wish to run it manually.

In this edition of the Windows Desktop Report, I'll take a closer look at Windows 7's Disk Defragmenter. As I do, I'll describe and show you how to take advantage of the new features built in to the new version.

This blog post is also available in PDF format in a TechRepublic download.

The problem of disk fragmentation

Before we get started with the new Disk Defragmenter, let's briefly explore the problem of fragmentation. You probably already know that disk fragmentation is a normal occurrence that happens over time as you use your hard disk.

On the hard disk, a cluster is the smallest unit of disk space that the operating system can address, and as such it is the smallest amount of space that can be allocated to a file. On a typical hard disk formatted with NTFS, the maximum default cluster size is 4KB, or 4,096 bytes.

Every time you copy new files to and delete old files from your hard disk, as well as when you add information to existing files, chances are good that your hard disk is becoming more and more fragmented with each operation you perform. For example, when you copy a file to your hard disk, the operating system attempts to place the file into the first available cluster that it finds on the hard disk. If the file is larger than that cluster, the operating system breaks the file into pieces and attempts to place the rest of the file in the next available clusters. If these subsequent clusters are not located right next to the first one, the file is fragmented.

Fragmentation also occurs when you add information to an existing data file. If the file you're working on outgrows its original cluster, the operating system will place the rest of the file in the next available cluster. Again the file becomes fragmented when the next available cluster isn't located right next to the first one. Furthermore, each time you delete files from your hard disk, you create available clusters, thus increasing the chances for future file fragmentation -- especially if the files you delete are themselves fragmented.

Over time, fragmentation can become a big problem if left unchecked. As pieces of files become spread out, the hard disk's read/write heads have to do more work to locate and transfer files to memory. The more the read/write heads move, the longer it takes to access files. Consequently, hard disk performance suffers.

Windows 7's answer to the problem

Of course, the answer to this problem is to defragment the hard disk on a regular basis in order to keep all of the related pieces of a file as contiguous as possible. However, rather than attempting to keep every single piece of a file in one place, as Windows XP's Disk Defragmenter did, Windows 7's Disk Defragmenter uses a new algorithm that analyzes each piece of a fragmented file and determines its size.

If a piece is larger than 64MB, then it is left where it is. The reason being that a piece that large will have a smaller impact on performance during disk read/write operations as opposed to the performance hit that Disk Defragmenter would take if it attempted to move the piece closer to the rest of the file. In other words, the benefit gained from leaving the 64MB fragment where it is far outweighs the benefit of moving it.

For example, moving one 64MB piece closer to the rest of the file's other pieces could potentially involve moving hundreds or thousands of other file pieces in order to make room. Doing so is a very disk-intensive operation that can cause other problems. For example, the additional disk I/O can put unnecessary wear and tear on the disk's physical components and increase the MTBF. Furthermore, Disk Defragmenter will hog system resources, and the system will be less responsive if you happened to need to perform some work while the hard disk was being defragmented. Another thing to consider is what happens to all those pieces that Disk Defragmenter was working on when it gets interrupted? Chances are that the fragmentation could get worse.

As such, Windows 7's Disk Defragmenter is designed to recognize that a certain amount of fragmentation is acceptable and that it can finish its job more quickly and more efficiently.

Additional features

In addition to its more efficient algorithm, Windows 7's Disk Defragmenter has several other new features that are designed to make it more powerful than its predecessors.

  • If you have more than on hard disk in your system, Windows 7's Disk Defragmenter can actually defragment multiple volumes, in parallel, at the same time. As such, you no longer have to wait for one disk to be defragmented before initiating the defragmenting operation on another disk.
  • Windows 7's Disk Defragmenter now has the ability to defragment system files that previous versions simply bypassed. For example, many NTFS metadata files can now be moved around during a defragmentation operation.
  • Should you need to interrupt or terminate a defragmentation operation, Windows 7's Disk Defragmenter can now do so more safely and quickly.
  • If you happen to have a solid-state media drive connected to your Windows 7 system, you'll discover that Windows disables defragmentation on that disk. Defragmentation of solid-state media isn't necessary and could even be detrimental.

Running Disk Defragmenter

Suppose that you have an external hard disk that isn't continuously attached to your Windows 7 system. If so, chances are that it is fairly fragmented. Manually running Disk Defragmenter is easy. Just click the Start button and type Disk Defragmenter in the Search box. When it appears in the results list, just click it to launch Disk Defragmenter (Figure A).

Figure A

In addition to the status panel, Disk Defragmenter contains three buttons.

As you can see, in addition to the status panel, there are three buttons in the Disk Defragmenter user interface -- one for changing the schedule, one for analyzing the amount of fragmentation, and one for launching the actual defragmenting operation.

The first thing you should do is select the disk in the Current Status panel and then click the Analyze Disk button. Once the analysis operation is complete, if the number in Last Run column is greater than 10%, like the one shown in Figure B, you should defragment the disk.

Figure B

If the number in Last Run column is greater than 10%, you should defragment the disk.
To continue, click the Defragment Disk button. The operation will begin, and you can monitor the progress, as shown in Figure C. Depending on the size of the hard disk and the amount of defragmentation, the operation can take a while to complete. However, you can continue to use your computer as you normally would with little interference from the defragmentation operation.

Figure C

While Disk Defragmenter is running, you can monitor the progress and use your computer as you normally would.

Adding a disk to the schedule

If you decide to leave the external disk connected to your computer, you may want to add it to Disk Defragmenter's schedule. To do so, click the Configure Schedule button and then click the Select Disks button. When you see the Select Disks for Schedule dialog box, just select the check box adjacent to the disk, if it is not already selected, as shown in Figure D.

Figure D

You can defragment multiple disks in parallel in Windows 7.

What's your take?

Do you use Windows built-in Disk Defragmenter or a third-party tool? Now that you know more about Windows 7's Disk Defragmenter, are you likely to switch? As always, if you have comments or information to share about this topic, please take a moment to drop by the TechRepublic Community Forums and let us hear from you

Stay on top of the latest Microsoft Windows tips and tricks with TechRepublic's Windows Desktop newsletter, delivered every Monday and Thursday. Automatically sign up today!

By Greg Shultz

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.