Ask Leo!

Why won't some files defrag?

Home » Windows

Summary: When you defrag files the pieces of the file are physically arranged for quicker access. But you can't defrag some files. At least, not easily.

My wife's computer shows several fragmented files remaining after a defrag. She has tried uninstalling some programs but some will not uninstall. What can I do to help rid her of this problem or is there a program that will help with this?

My first reaction is to suggest not calling it a problem. It's not at all uncommon to have some files that refuse to defrag, and that's quite alright.

Let's look at some of the reasons, and some of the ways to force the issue if you still feel you need to.

Defragging, or more properly, defragmenting, is the process of taking all the parts or "fragments" of a file on your hard disk and making sure that they are physically next to each other, and in order. Files don't need to be that way ... the first part of your file could be on the outer rim of the hard disk, the next part somewhere on the inner portion, and other parts scattered in between. The "problem" that defragging solves is when all those pieces are next to each other and in order, the hard disk has to do a less work to access the file.

"The most common cause for files not getting defragged is that there's not enough free space on the hard disk to do so."

There are several technical approaches to defragging, but most require that you have enough free space on your hard disk for a copy of the largest file that needs defragging. Typically defraggers just require some percentage of free space, like 10% or 15%.

If there's not enough room for a second, temporary, copy of the file then the file cannot be defragged. The most common cause for files not getting defragged is that there's not enough free space on the hard disk to do so.

The second most common cause is that the file is in use by some program. That's why most defragging utilities suggest you close down all running programs prior to attempting to defrag. One of the things you can do when you run into this situation is to look at the list of files that were not defragged and see if they are in use. This article: How can I find out who is using a "file in use"? explains how. If you can, you can then shut down the program that has the file open, and try defragging again.

The next problem is that the operating system, as part of its normal workings, often has files open, and that therefore cannot be defragged. One very common example is windows paging or swap file. The folks out at Sysinternals.com have a free utility, PageDefrag for just this purpose. It can schedule a defrag of the system files on your next boot, before the system is actually running.

Similarly, booting from a CD such that the operating system is running from the CD and not your hard drive might also be an option to allow a normal disk defragger to run.

But my question is - why bother?

Defragging the files you can defrag easily, and regularly, gets you 95% of the performance gain you're looking for anyway. Jumping through these extra hoops to get the system files defragged is typically just not worth it, unless you've determined that these files are severely fragmented. And that's rare.

My recommendation is to simply do the normal defrag every so often. If you leave your computer on all the time, this article, What is 'defragging', and why should I do it? even includes instructions on setting up an automated defrag every night, which is exactly what I do.

Related:

Article 10455 | Posted June 26, 2006

Recent Comments
42 Comments

This is great information, but my issue is slightly different. Yesterday, for the first time, I got the message that some files did not defrag, but NO FILES were listed in the log. In the past, when a file did not defrag, it was listed and I was able to resolve it. Did another defrag today, same issue. Thanks.

Posted by: Russ at June 27, 2008 4:41 PM

Hi there!

I use the windows disk defragmenter on my XP. It only gets to 40% and then comes up with that error message saying that some files could not be defragmented.
I recently reformated my harddrive (as it was running too slow) and i got this message before (and after) the reformat.

I have 50% (35Gb) free space on my hard drive...

Can you offer any advice?

Cheers!

Posted by: Luke at July 17, 2008 12:56 AM

Zipped files won't defrag. That was the problem when I was getting the same message. May be something to look for.

Posted by: Penny at July 17, 2008 6:18 AM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

".zip" files defrag just fine. Defragging doesn't apply to
the files within a .zip.

Some files won't defrag typically because they're too big,
or perhaps because they're exclusively locked by an
application or by the operating system. For example normal
defrag programs cannot defrag the paging file - that
requires extra steps (and it's typically not worth it
anyway.)

Leo


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFIf3/XCMEe9B/8oqERAr6LAKCEO8r+AOqTZhZCu/0NmwrYYwwCNwCfSgIt
DMMomoOMB/Ufn+tZTSv0LnM=
=AVBI
-----END PGP SIGNATURE-----

Posted by: Leo at July 17, 2008 10:22 AM

You have some good advice, Leo. My hats off to ya!

Posted by: Tom at September 6, 2008 5:19 AM

I installed MS XP SP3 upon virtual PC over Vista, the Virtual PC has Elastic virtual Hard drives, and all the files within the .vhd are less than 1.5gb, neverthenless, the .vhd weights about 3.5gb, I defragged it, i notieced most of the files were nicely aranged one next to other excepting some small pieces over there.
At sight I saw the space between most of the files and the small files over there was a bit more than the space used by most of the files, that makes me think, if I defragged those files, the page files, I may reduce the .vhd size about 1.5gb!, so, I need a Defragmeter thet defraggs it all.

Posted by: Eternalbodom at September 8, 2008 2:32 PM

I'm getting the same "some files would not defrag" message. However, my concern is that I have a huge amount of fragmented files and Windows XP keeps saying I still need to defragment. I have some very big audio recording files and I'm wondering if they're just too big to fix. Also, I'm using Norton System Works Speed Disk to optimize and it's taken days just to move 10% of the files. Should I move some of the files to my other drive and try to defragment a little at a time? I'm moving pretty slow in that drive and I need to be fast in the studio. Thanks for all your great advice, keep it up!

Posted by: Jim Rowbottom at September 21, 2008 8:05 PM

I have 57.23 gigs total on my NTFS,hard drive with only 13.24 gigs, (23%) free space. There's an enormous amount of fragmented files, (about as much as total contiguous files and unmovable files combined.) Up until a few weeks ago, when I defragged, I got a pretty clean slate and had plenty of free space, but the fragmented file(s)started growing and has continued to grow and my free disc space has dropped from 34% down to the current 23%. I've checked and none of my files are in use by another user,entity, etc. I've exhaused my defragging efforts and my question is - What happens when I run out of space? Is my computer going to lock up or what? Thanks, Jimmy

Fragmentation is not related to free space. In you case I would absolutely investigate where your hard disk space is going, but focusing on fragmentation is not going to get you there. I would have you start with this article: Where's my disk space going?
- Leo
25-Oct-2008

Posted by: Jimmy Moore at October 24, 2008 11:44 AM

i have windows xp .i clicked MY COMPUTER then SHARED DOCUMENTS and opened .nothing happend !!

Posted by: ali sherif at November 1, 2008 12:10 PM

How do you consolidate the system files so you have larger free contigous space on your drive?
It is impossible for my page file to be in a single fragment because I have unmovable system files scattered over the disk. I have jkdefrag, contig and pagedefrag. I also have format but I'd rather not use! It's not very important but I'd like to know how.

Posted by: Robert Newbold at November 28, 2008 8:21 AM

Post a comment on "Why won't some files defrag?":






(Email Address will not be published.)

Remember Me?

By popular demand...
my tip jar
Cuppa Joe
Buy Leo a Latte!

(you may use HTML tags for style)

New!

RSS feed Subscribe to the RSS Feed specifically for comments on this article.

Before commenting, please...

Please wait. Your comment is being processed ...


Ask Your Question:


ask-leo.com
Web

Stay Informed

Weekly Newsletter

Archives

By Category
By Date

Advertisers

Advertise on Ask Leo!

««   »»

Question? - Ask Leo!
Who is Leo?
Link to Leo!

Terms, Conditions & Privacy