Software

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!

About

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.

32 comments
snhsrdhr
snhsrdhr

thank you very much. explained it in a very simple manner. thanks again

jcover13a
jcover13a

My external drives (2-USBs) are not showing up on Disk Defrag's list. Is there a way to add them?

Spexi
Spexi

Must mention MyDefrag which been my own choice for some time. It has features for optimize the hdd by moving files to the beginning of disk or preferable in make the system work faster except the usual defragmentation. Other useful tools might be Windows CHKDSK.exe UltraDefrag, Auslogics Disk Defrag, IObit Smart Defrag, Piriform, Puran Defrag, Paragon, O&O. But hey, it is 2010:) Shouldn't Microsoft found out one good solution in prevent fragmented drives together with the release of Windows 7? I mean couldn't they find a better way than put it there with a new service that need power for this task to repeat itself. In my eyes an easy solution in hide the real problem.

{DvT}Hex
{DvT}Hex

Huh? The defrager shows when it was defraged last and the degree of fragmentation. This is "detailed drive data"? "Pass1: 30% relocated," to use the example screenshot in the article, is "detailed"?

Pegleg Pete
Pegleg Pete

MTBF is MEAN time between failures - that is, the average time for all units of that disk model (either as a design parameter or from actual experience over time of a large number of units). It does not mean the time between (or before) failure of any individual disk. Maybe TBF would be a more appropriate abbreviation?

TuneUp Utilities
TuneUp Utilities

Hi Greg?I really appreciate this post! I?ve been having trouble with my C-drive filling up lately, yet I don?t have an overload of documents or programs on my computer. I think it may be due to fragmentation. I don?t have Windows 7, so how often would you recommend running a disk defragmenter on Vista? Does Vista?s defragmenter differ significantly from 7?

RealGem
RealGem

A higher average time between failure is good. Thus lower is bad. I think you meant lower.

DWalker88001
DWalker88001

" the additional disk I/O can put unnecessary wear and tear on the disk?s physical components and increase the MTBF" You meant to say decrease, not increase. Oops, I see that this point was already made. Oh well.

ziffdavis
ziffdavis

Interestingly, the Defrag auto-run works even while your computer is in "sleep" mode. I use a laptop as my primary computer, and just close the lid at the end of the day to put it into "sleep" mode. The defragger still runs at its scheduled time (1:00 am Wednesday).

mikec
mikec

I notice that win7 defrag does several passes. How many does it do by default? How many are necessary? Thanks Mike C

sammy.mah
sammy.mah

Auslogics defrag is still better. I use it on a lot of companies systems...now you have one better defrag program for all OS.

JohnMcGrew
JohnMcGrew

...Windows prevents fragmentation by more intelligently writing data in the first place, and performs its defrag operation constantly during idle cycle periods.

seanferd
seanferd

I never played around with this, either, when I was running the beta & RC. Very cool. I still rather miss the functionality of (at least the older) Norton defragmenters. You could click on the graphic and find out which files were in that representative block.

eamiteshwar
eamiteshwar

wow i never thought windows disk defrag software could have so many features. and yes, thanks for explaining the cluster concept, it was really helpful.

wmoore
wmoore

It's a nit, but, the additional I/O related to moving files unecessarily will reduce the MTBF not increase it.

bruce.dimon
bruce.dimon

I think you meant to say decrease the mean time between failures. The bigger performance hit comes from a fragmented page file. I am using a free Sysinternals tool that defragments my XP box during boot. I'll look for something similar for Windows 7 in case that page file fragments.

Mark W. Kaelin
Mark W. Kaelin

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?

Greg Shultz
Greg Shultz

...in the Select Disks for Schedule dialog box, as shown in Figure D? Are they solid-state media? Windows disables defragmentation on those disks. Defragmentation of solid-state media isn?t necessary and could even be detrimental.

khiatt
khiatt

I think he meant more detailed than Vista, which only says it's running.

knudson
knudson

Delete the page file completely. Defrag the HD. Recreate the page file FIXed size as 1.5 to 2x real memory. It will never fragment.

sakkar
sakkar

I use an excellent third party defrag utility that not only defrags automatically, but also prevents most of the fragmentation from happening in the first place. I never liked the windows defragger...too slow, insufficient reporting, incomplete defrag and a general lack of customization options.

laura.walker
laura.walker

So would defragging be required on a SSD drive in the future ? The very action would help shorten the SSD's life (if by a very small amount).

quark
quark

I got only three questions: what be a "disk?" what be a "defragmenter?" and what what be "Windows 7" Thankee kindly.

Greg Shultz
Greg Shultz

...I meant to elude the Vista comparison... Vista didn't show any details at all.

snypez
snypez

Like the operating system OS X is based on does!

npjadhav10
npjadhav10

If possible, please give reference of the excellent third party defrag utility that not only defrags automatically, but also prevents most of the fragmentation from happening in the first place.

mckinnej
mckinnej

No. SSDs are electronic sort of like system memory. They don't fragment in the way conventional HDs do. They have their own problems, but fragmentation is not one of them.

khiatt
khiatt

Diskeeper 2010 does that for my servers

A.C
A.C

SSDs fragment the same way as an HD, as the fragmentation is a function of the OS and filing system, not the storage medium. The difference is more about how the two devices access data, an HD is like a old vinyl LP, if you play the tracks in order, you only need to position the arm once, if you play them out of order you need to position the arm many times, as the HD is mechanical it takes a finite (and in elctronics terms, very long) time to move the arm to find the required track. The time taken depends on how far the arm needs to move and where the data is on the disc as it rotates under the head. In an SSD, the action of seeking is very fast (something like one million times faster) and is always the same no matter where the data is, this means that fragmention may happen, it's just not a problem in the same way as on a rotating mechanical storage device. On an SSD the time to read a piece of data should be the same if the data is scattered as it is if the data is contiguous.

Editor's Picks