Helping people with computers... one answer at a time.

Occasionally, the disk defragmenter will tell you that you still need to defrag even after having just done so. We'll look at why, and what to do.

When I defrag and then analyze, defragmenter tells me over and over again that I need to defrag? Why would it do that?

I'm assuming what you mean is that you've defragged, and then immediately thereafter run the analysis again only to have it tell you that "this volume should be defragmented", even though that's exactly what you've just done.

I can think of a couple of reasons.

The first reason is simply lack of disk space.

Defragging typically works simply by moving files around on your disk. In a nutshell, if a file is physically spread out in 15 different places on the hard disk, the defragger just looks for a large unused space on the disk that's big enough to hold the entire file, and moves it there. Repeat that over and over again for all the files on your hard disk, and you're defragged.

Now, naturally, that's an over simplification. For example, the defragger can also make choices on which files to move around first, so that it can create bigger contiguous unused spaces for the bigger fragmented files. The defragger may also take into account the physical location of files on the disk and not just make the files contiguous, but move them all so that they're near each other, which means that the disk doesn't need to work as hard when it moves from one file to the next.

"Defragging typically works simply by moving files around on your disk."

But ultimately defragging boils down to copying fragmented files into areas of the disk that are big enough to hold the entire file without fragmenting it.

So, what if you have a file on your hard disk that is fragmented but there's not enough contiguous free space on the disk to make a copy of it? (And remember, it's not just about free space, it's about free space that is contiguous; free space that has unfragmented portions that are large enough to hold the file in question.)

That file can't be defragged.

And if you have a lot of files that can't be defragged?

It'll look like your hard disk still needs defragging, even after the defragging tool made its best effort to do so.

The second reason is really very much like the first, with the added complexity of files that cannot be defragged by normal defragging tools.

In particular, your Windows paging or swap file cannot be defragged by the Windows defragger, nor can the system registry files. That means that if over time as these have grown they become fragmented, they will contribute to what the defragger sees as the "need" for defragging, but they cannot be part of the solution since they can't be defragged.

So, what can you do?

To state the obvious: free up some disk space and try again. Try emptying your browser cache, or even looking into what's taking up space and making decisions to move, archive or delete data to make more room.

Typically, with more room, a defrag will be much happier.

And in all honesty, doing nothing is also an option. Even though your defragger might report that your drive should still be defragged, if you've just done so then there's nothing wrong with ignoring the second report. Technically you might suffer a minor performance loss, but in most cases the loss isn't noticeable in the least, and the effort of cleaning up and getting the defragger to stop complaining simply isn't worth it.

And a third option is to use a different defragging tool. There's definitely some magic involved in the approaches to defragging, and some tools do a much better job of defragging in a low-space situation. But as you might guess, this is also something I don't consider to be worth the expense to address.

And finally, specifically for those system files that can't be defragged by "normal" defragging tools, look into PageDefrag, a free tool from Microsoft and Sysinternals that will defrag those files on reboot, before Windows has been loaded.

Article C3528 - October 11, 2008 « »

Share this article with your friends:

Share this article on Facebook Tweet this article Email a link to this article
Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

6 Comments
DarkKnight
October 13, 2008 4:22 AM

Regarding third party utilities; here's my experience from a few weeks ago:
I used to get the 'Some files on this volume could not defragmented' message on my XP gaming rig. Turns out the MFT and pagefile were heavily fragmented and the drive was about 80% full.

Tried most of the free defraggers like auslogics, jkdefragger, defraggler etc, and end result: none of them could do anything about the MFT which is a critical system file. Downloaded Diskeeper 2008's free trial version (ended up buying it later because it was so good) and it was able to defrag the whole drive and then the MFT and pagefile via a boot-time defrag without breaking into a sweat. It was also the only one that allowed me to multitask without a hitch while running in the background. So, if system files are fragmented, it's better to go directly to the trial version of Diskeeper and fix the problem rather than wasting time with the 'free' utilities. Atleast you can use Diskeeper for 30 days for free legally.

Dave Ellis
October 14, 2008 8:57 AM

I've been curious about this defragging problem on one of my computers for a long time - turns out it was a fragmented pagefile. Thanks for the solution, the little program worked perfectly.

Packrat1947
October 15, 2008 5:33 AM

PerfectDisk will do the same things as Disk Keeper. Diskkeeper seemes a bit too complicated to use. Some people us the "set and forget" option and sleep well.

Richard
October 15, 2008 6:27 PM

The new defragmenting programs aren't like the one that came with DOS 6.x which only needed a single free cluster to completely defrag a disk and it would do it ever so slowly and the only thing it couldn't defrag was the windows permanent swapfile;

there's a free utility for defragmenting the pagefile & registry etc. files called PageDefrag from sysinternals on the MS website
it's a stand alone program that doesn't install but just sets the "run once" flag and just defrags the pagefile and registry files @ boot

PageDefrag works on Windows NT 4.0, Windows 2000, Windows XP, and Server 2003

PageDefrag isn't for general drive defragmenting but is an additional companion tool for a regular defrag program.

PageDefrag is mentioned (and linked to) in the article you're commenting on.
- Leo
16-Oct-2008
Paul Jones
October 21, 2008 11:57 AM

There are 2 gotchas with the windows XP defrag:
1) Doesn't deal with pagefiles or MFT
2) requires multiple passes to completely defrag what can be defragged.

Both of these gotchas come from the fact that XP's defragger is actually a very scaled down version of DiskKeeper. If it was a full scale version, there would be no reason for you to buy the full version. Help, About Disk Defragmenter will show:
Disk Defragmenter
Microsoft Corp, Executive Software Int'l
Version: 1.0

Executive Software produces DiskKeeper.

If you have enough memory, you can set the page file to No Paging File, reboot, defrag, then set it to a custom size and reboot one more time. I use 2047 for both numbers, anything at 2GB or above seems to slow things down a tiny bit. By forcing a single size, the page file won't grow, and therefore won't fragment. If you have more than one hard drive, multiple page files can speed things up. Put a 1024 on C and a 1024 on D, and XP will try to use the pagefile on the least used drive, thus speeding things up a bit.

sVen
October 18, 2011 11:42 AM

PageDefrag, from Sysinternals, doesn't work on 64 bit systems. However, if your PC is loaded enough to warrant it, you can erase (not just disable) the pagefile, then defrag. It's probably more hassle than it's worth.

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to http://askleo.com/ask to ask your question.